Javolution 6.0.0 java
javolution.xml.stream.XMLOutputFactory Interface Reference
Inheritance diagram for javolution.xml.stream.XMLOutputFactory:
[legend]
Collaboration diagram for javolution.xml.stream.XMLOutputFactory:
[legend]

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"
 

Detailed Description

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]

Author
Jean-Marie Dautelle
Version
6.0 December 12, 2012

Definition at line 57 of file XMLOutputFactory.java.

Member Function Documentation

◆ clone()

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().

Here is the caller graph for this function:

◆ createXMLStreamWriter() [1/3]

XMLStreamWriter javolution.xml.stream.XMLOutputFactory.createXMLStreamWriter ( OutputStream  stream) throws XMLStreamException

Returns a XML stream writer to the specified output stream (UTF-8 encoding).

Parameters
streamthe stream to write to.
Returns
a xml stream writer possibly recycled.
Exceptions
XMLStreamException

Implemented in javolution.xml.internal.stream.XMLOutputFactoryImpl.

◆ createXMLStreamWriter() [2/3]

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.

Parameters
streamthe stream to write to.
encodingthe encoding to use.
Returns
a xml stream writer possibly recycled.
Exceptions
XMLStreamException

Implemented in javolution.xml.internal.stream.XMLOutputFactoryImpl.

◆ createXMLStreamWriter() [3/3]

XMLStreamWriter javolution.xml.stream.XMLOutputFactory.createXMLStreamWriter ( Writer  writer) throws XMLStreamException

Returns a XML stream writer to the specified i/o writer.

Parameters
writerthe writer to write to.
Returns
a xml stream writer possibly recycled.
Exceptions
XMLStreamException

Implemented in javolution.xml.internal.stream.XMLOutputFactoryImpl.

◆ getProperty()

Object javolution.xml.stream.XMLOutputFactory.getProperty ( String  name) throws IllegalArgumentException

Gets a feature/property on the underlying implementation.

Parameters
namethe name of the property
Returns
the value of the property
Exceptions
IllegalArgumentExceptionif the property is not supported.

Implemented in javolution.xml.internal.stream.XMLOutputFactoryImpl.

◆ isPropertySupported()

boolean javolution.xml.stream.XMLOutputFactory.isPropertySupported ( String  name)

Queries the set of properties that this factory supports.

Parameters
namethe name of the property (may not be null).
Returns
true if the property is supported; false otherwise.

Implemented in javolution.xml.internal.stream.XMLOutputFactoryImpl.

◆ setProperty()

void javolution.xml.stream.XMLOutputFactory.setProperty ( String  name,
Object  value 
) throws IllegalArgumentException

Allows the user to set specific features/properties on the underlying implementation.

Parameters
namethe name of the property.
valuethe value of the property.
Exceptions
IllegalArgumentExceptionif the property is not supported.

Implemented in javolution.xml.internal.stream.XMLOutputFactoryImpl.

Member Data Documentation

◆ AUTOMATIC_EMPTY_ELEMENTS

final String javolution.xml.stream.XMLOutputFactory.AUTOMATIC_EMPTY_ELEMENTS = "javolution.xml.stream.automaticEmptyElements"
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().

◆ INDENTATION

final String javolution.xml.stream.XMLOutputFactory.INDENTATION = "javolution.xml.stream.indentation"
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().

◆ IS_REPAIRING_NAMESPACES

final String javolution.xml.stream.XMLOutputFactory.IS_REPAIRING_NAMESPACES = "javolution.xml.stream.isRepairingNamespaces"
static

◆ LINE_SEPARATOR

final String javolution.xml.stream.XMLOutputFactory.LINE_SEPARATOR = "javolution.xml.stream.lineSeparator"
static

◆ NO_EMPTY_ELEMENT_TAG

final String javolution.xml.stream.XMLOutputFactory.NO_EMPTY_ELEMENT_TAG = "javolution.xml.stream.noEmptyElementTag"
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. "&lt;empty /&gt;" replaced by "&lt;empty&gt;&lt;/empty&gt;"), 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().

◆ REPAIRING_PREFIX

final String javolution.xml.stream.XMLOutputFactory.REPAIRING_PREFIX = "javolution.xml.stream.repairingPrefix"
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().


The documentation for this interface was generated from the following file: