| java.lang.Object javolution.xml.stream.XMLOutputFactory
XMLOutputFactory | abstract public class XMLOutputFactory (Code) | | The class represents the factory for getting
XMLStreamWriter intances.
The
XMLOutputFactory.newInstance() default implementation automatically
ObjectFactory.recycle recycles any writer which has been
XMLStreamWriter.close closed .
Usage example:[code]
// Lets format to an appendable.
TextBuilder xml = new TextBuilder();
AppendableWriter out = new AppendableWriter(xml);
// Creates a factory producing writers using tab indentation.
XMLOutpuFactory factory = XMLOutputFactory.newInstance();
factory.setProperty(XMLOutputFactory.INDENTATION, "/t");
// Creates a new writer (potentially recycled).
XMLStreamWriter writer = factory.createXMLStreamReader(out);
// Formats to XML.
writer.writeStartDocument();
writer.writeStartElement(...);
...
writer.close(); // Automatically recycles this writer.
out.close(); // Underlying output should be closed explicitly.
// Displays the formatted output.
System.out.println(xml);
[/code]
author: Jean-Marie Dautelle version: 4.0, September 4, 2006 |
Field Summary | |
final public static String | AUTOMATIC_EMPTY_ELEMENTS Property indicating if the stream writers are allowed to automatically
output empty elements when a start element is immediately followed by
matching end element
(type: Boolean , default: FALSE ). | final public static Configurable | DEFAULT Holds the XMLOutputFactory default implementation (configurable). | final public static String | INDENTATION Property used to specify an indentation string; non-null indentation
forces the writer to write elements into separate lines
(type: String , default: null ). | final public static String | IS_REPAIRING_NAMESPACES Property used to set prefix defaulting on the output side
(type: Boolean , default: FALSE ). | final public static String | REPAIRING_PREFIX Property used to specify the prefix to be appended by a trailing
part (a sequence number) in order to make it unique to be usable as
a temporary non-colliding prefix when repairing namespaces
(type: String , default: "ns" ). |
AUTOMATIC_EMPTY_ELEMENTS | final public static String AUTOMATIC_EMPTY_ELEMENTS(Code) | | Property indicating if the stream writers are allowed to automatically
output empty elements when a start element is immediately followed by
matching end element
(type: Boolean , default: FALSE ).
|
DEFAULT | final public static Configurable DEFAULT(Code) | | Holds the XMLOutputFactory default implementation (configurable).
|
INDENTATION | final public static String INDENTATION(Code) | | Property used to specify an indentation string; non-null indentation
forces the writer to write elements into separate lines
(type: String , default: null ).
|
IS_REPAIRING_NAMESPACES | final public static String IS_REPAIRING_NAMESPACES(Code) | | Property used to set prefix defaulting on the output side
(type: Boolean , default: FALSE ).
|
REPAIRING_PREFIX | final public static String REPAIRING_PREFIX(Code) | | Property used to specify the prefix to be appended by a trailing
part (a sequence number) in order to make it unique to be usable as
a temporary non-colliding prefix when repairing namespaces
(type: String , default: "ns" ).
|
XMLOutputFactory | protected XMLOutputFactory()(Code) | | Default constructor.
|
isPropertySupported | abstract public boolean isPropertySupported(String name)(Code) | | Queries the set of properties that this factory supports.
Parameters: name - the name of the property (may not be null). true if the property is supported;false otherwise. |
setProperty | abstract public void setProperty(String name, Object value) throws IllegalArgumentException(Code) | | Allows the user to set specific features/properties on the underlying
implementation.
Parameters: name - the name of the property. Parameters: value - the value of the property. throws: IllegalArgumentException - if the property is not supported. |
|
|