|
Javolution 6.0.0 java
|
Public Member Functions | |
| XMLStreamWriter | createXMLStreamWriter (Writer writer) throws XMLStreamException |
| XMLStreamWriter | createXMLStreamWriter (OutputStream stream) throws XMLStreamException |
| XMLStreamWriter | createXMLStreamWriter (OutputStream stream, String encoding) throws XMLStreamException |
| void | setProperty (String name, Object value) throws IllegalArgumentException |
| Object | getProperty (String name) throws IllegalArgumentException |
| boolean | isPropertySupported (String name) |
| XMLOutputFactory | clone () |
Static Public Attributes | |
| static final String | IS_REPAIRING_NAMESPACES = "javolution.xml.stream.isRepairingNamespaces" |
| static final String | REPAIRING_PREFIX = "javolution.xml.stream.repairingPrefix" |
| static final String | INDENTATION = "javolution.xml.stream.indentation" |
| static final String | LINE_SEPARATOR = "javolution.xml.stream.lineSeparator" |
| static final String | AUTOMATIC_EMPTY_ELEMENTS = "javolution.xml.stream.automaticEmptyElements" |
| static final String | NO_EMPTY_ELEMENT_TAG = "javolution.xml.stream.noEmptyElementTag" |
The OSGi factory service to create XMLStreamWriter instances. For each bundle, a distinct factory instance is returned and can be individually configured (if not enough the factory can be cloned). [code] import javolution.xml.stream.*; public class Activator implements BundleActivator { public void start(BundleContext bc) throws Exception {
// Configures factory.
ServiceTracker<XMLOutputFactory, XMLOutputFactory> tracker
= new ServiceTracker<>(bc, XMLOutputFactory.class, null);
tracker.open();
tracker.getService().setProperty(XMLOutputFactory.INDENTATION, "/t"); // Use tab for indentations.
// Instantiates a new writer.
TextBuilder xml = new TextBuilder();
AppendableWriter out = new AppendableWriter(xml);
XMLStreamWriter writer = tracker.getService().createXMLStreamWriter(out);
// Formats to XML.
writer.writeStartDocument("1.0");
writer.writeCharacters("\n");
writer.writeStartElement("ns1", "sample", "http://www.e.com/ns1");
writer.writeNamespace("ns1", "http://www.e.com/ns1");
writer.writeEndElement();
writer.writeEndDocument();
// Closes the writer which may be recycled back to the factory.
writer.close();
// Displays the formatted output.
System.out.println(xml);
} [/code]
Definition at line 57 of file XMLOutputFactory.java.
| XMLOutputFactory javolution.xml.stream.XMLOutputFactory.clone | ( | ) |
Returns a clone of this factory which can be independently configured.
Implemented in javolution.xml.internal.stream.XMLOutputFactoryImpl.
Referenced by javolution.xml.internal.stream.XMLOutputFactoryImpl.clone().
| XMLStreamWriter javolution.xml.stream.XMLOutputFactory.createXMLStreamWriter | ( | OutputStream | stream | ) | throws XMLStreamException |
Returns a XML stream writer to the specified output stream (UTF-8 encoding).
| stream | the stream to write to. |
| XMLStreamException |
Implemented in javolution.xml.internal.stream.XMLOutputFactoryImpl.
| XMLStreamWriter javolution.xml.stream.XMLOutputFactory.createXMLStreamWriter | ( | OutputStream | stream, |
| String | encoding | ||
| ) | throws XMLStreamException |
Returns a XML stream writer to the specified output stream using the specified encoding.
| stream | the stream to write to. |
| encoding | the encoding to use. |
| XMLStreamException |
Implemented in javolution.xml.internal.stream.XMLOutputFactoryImpl.
| XMLStreamWriter javolution.xml.stream.XMLOutputFactory.createXMLStreamWriter | ( | Writer | writer | ) | throws XMLStreamException |
Returns a XML stream writer to the specified i/o writer.
| writer | the writer to write to. |
| XMLStreamException |
Implemented in javolution.xml.internal.stream.XMLOutputFactoryImpl.
| Object javolution.xml.stream.XMLOutputFactory.getProperty | ( | String | name | ) | throws IllegalArgumentException |
Gets a feature/property on the underlying implementation.
| name | the name of the property |
| IllegalArgumentException | if the property is not supported. |
Implemented in javolution.xml.internal.stream.XMLOutputFactoryImpl.
| boolean javolution.xml.stream.XMLOutputFactory.isPropertySupported | ( | String | name | ) |
Queries the set of properties that this factory supports.
| name | the name of the property (may not be null). |
true if the property is supported; false otherwise. Implemented in javolution.xml.internal.stream.XMLOutputFactoryImpl.
| void javolution.xml.stream.XMLOutputFactory.setProperty | ( | String | name, |
| Object | value | ||
| ) | throws IllegalArgumentException |
Allows the user to set specific features/properties on the underlying implementation.
| name | the name of the property. |
| value | the value of the property. |
| IllegalArgumentException | if the property is not supported. |
Implemented in javolution.xml.internal.stream.XMLOutputFactoryImpl.
|
static |
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).
Definition at line 92 of file XMLOutputFactory.java.
Referenced by javolution.xml.internal.stream.XMLOutputFactoryImpl.getProperty(), javolution.xml.internal.stream.XMLStreamWriterImpl.getProperty(), javolution.xml.internal.stream.XMLOutputFactoryImpl.isPropertySupported(), and javolution.xml.internal.stream.XMLOutputFactoryImpl.setProperty().
|
static |
Property used to specify an indentation string; non-null indentation forces the writer to write elements into separate lines (type: String, default: null).
Definition at line 78 of file XMLOutputFactory.java.
Referenced by javolution.xml.internal.stream.XMLOutputFactoryImpl.getProperty(), javolution.xml.internal.stream.XMLStreamWriterImpl.getProperty(), javolution.xml.internal.stream.XMLOutputFactoryImpl.isPropertySupported(), and javolution.xml.internal.stream.XMLOutputFactoryImpl.setProperty().
|
static |
Property used to set prefix defaulting on the output side (type: Boolean, default: FALSE).
Definition at line 63 of file XMLOutputFactory.java.
Referenced by javolution.xml.internal.stream.XMLOutputFactoryImpl.getProperty(), javolution.xml.internal.stream.XMLStreamWriterImpl.getProperty(), javolution.xml.internal.stream.XMLOutputFactoryImpl.isPropertySupported(), and javolution.xml.internal.stream.XMLOutputFactoryImpl.setProperty().
|
static |
Property used to specify the new line characters (type: String, default: "\n").
Definition at line 84 of file XMLOutputFactory.java.
Referenced by javolution.xml.internal.stream.XMLOutputFactoryImpl.getProperty(), javolution.xml.internal.stream.XMLStreamWriterImpl.getProperty(), javolution.xml.internal.stream.XMLOutputFactoryImpl.isPropertySupported(), and javolution.xml.internal.stream.XMLOutputFactoryImpl.setProperty().
|
static |
Property indicating if the stream writers are not allowed to use empty element tags (type: Boolean, default: FALSE). When set, this property forces the use of start/end element tag (e.g. i.e. "<empty />" replaced by "<empty></empty>"), This property takes precedence over AUTOMATIC_EMPTY_ELEMENTS.
Definition at line 102 of file XMLOutputFactory.java.
Referenced by javolution.xml.internal.stream.XMLOutputFactoryImpl.getProperty(), javolution.xml.internal.stream.XMLStreamWriterImpl.getProperty(), javolution.xml.internal.stream.XMLOutputFactoryImpl.isPropertySupported(), and javolution.xml.internal.stream.XMLOutputFactoryImpl.setProperty().
|
static |
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").
Definition at line 71 of file XMLOutputFactory.java.
Referenced by javolution.xml.internal.stream.XMLOutputFactoryImpl.getProperty(), javolution.xml.internal.stream.XMLStreamWriterImpl.getProperty(), javolution.xml.internal.stream.XMLOutputFactoryImpl.isPropertySupported(), and javolution.xml.internal.stream.XMLOutputFactoryImpl.setProperty().