Package org.geotools.xml
Class DocumentWriter
Object
DocumentWriter
This is the thing that writes documents.
This will create valid XML documents, given an object and a schema.
- Author:
- dzwiers
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Element or String ... include a ref to an Element to be used, or a string representing the name of the elementstatic final String
The Encoding which should be used for the Document which should be created.static final Logger
static final String
a map of URI->URI representing targetNamespace->Locationstatic final String
Schema[] or String[]...static final String
boolean ... include the key to use the "nearest" strategy for searching schemas.static final String
Writer ... include the key to represent true when writing to files, include a Writer to write to otherwise. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Sets the logger levelstatic void
Write value to file using provided schema.static void
Entry Point to Document writer.static void
Write value to file using provided schema.static void
Entry Point to Document writer.static void
-
Field Details
-
logger
-
WRITE_SCHEMA
Writer ... include the key to represent true when writing to files, include a Writer to write to otherwise.- See Also:
-
BASE_ELEMENT
Element or String ... include a ref to an Element to be used, or a string representing the name of the element- See Also:
-
SCHEMA_ORDER
Schema[] or String[]... The order to search the schemas for a valid element, either an array of ref to Schema instances or an Array or TargetNamespaces- See Also:
-
ENCODING
The Encoding which should be used for the Document which should be created.- See Also:
-
USE_NEAREST
boolean ... include the key to use the "nearest" strategy for searching schemas. This will be ignored if a schema order was set. When not included the schema order as they appear in the orginal schema will be used.- See Also:
-
SCHEMA_LOCATION_HINT
a map of URI->URI representing targetNamespace->Location- See Also:
-
-
Constructor Details
-
DocumentWriter
public DocumentWriter()
-
-
Method Details
-
setLevel
Sets the logger level- Parameters:
l
- Level
-
writeDocument
public static void writeDocument(Object value, Schema schema, File f, Map<String, Object> hints) throws OperationNotSupportedException, IOExceptionWrite value to file using provided schema.Hints:
- WRITE_SCHEMA - (non null) write to outputfilename.xsd
- BASE_ELEMENT - (Element) mapping of value to element instance
- USE_NEAREST - (Boolean) not implemented
- SCHEMA_ORDER - (String[] or Schema[]) resolve ambiguity & import
-
writeDocument
public static void writeDocument(Object value, Schema schema, Writer w, Map<String, Object> hints) throws OperationNotSupportedException, IOExceptionEntry Point to Document writer.Hints:
- WRITE_SCHEMA - (Writer) will be used to write the schema
- BASE_ELEMENT - (Element) mapping of value to element instance
- USE_NEAREST - (Boolean) not implemented
- SCHEMA_ORDER - (String[] or Schema[]) resolve ambiguity & import
- Parameters:
hints
- optional hints for writing- Throws:
OperationNotSupportedException
IOException
-
writeFragment
public static void writeFragment(Object value, Schema schema, File f, Map<String, Object> hints) throws OperationNotSupportedException, IOExceptionWrite value to file using provided schema.Hints:
- BASE_ELEMENT - (Element) mapping of value to element instance
- USE_NEAREST - (Boolean) not implemented
- SCHEMA_ORDER - (String[] or Schema[]) resolve ambiguity & import
-
writeFragment
public static void writeFragment(Object value, Schema schema, Writer w, Map<String, Object> hints) throws OperationNotSupportedException, IOExceptionEntry Point to Document writer.Hints:
- BASE_ELEMENT - (Element) mapping of value to element instance
- USE_NEAREST - (Boolean) not implemented
- SCHEMA_ORDER - (String[] or Schema[]) resolve ambiguity & import
- Parameters:
hints
- optional hints for writing- Throws:
OperationNotSupportedException
IOException
-
writeSchema
public static void writeSchema(Schema schema, Writer w, Map<String, Object> hints) throws IOException- Throws:
IOException
-