Top Description Fields Constructors Methods
org.codehaus.stax2

public abstract Class XMLOutputFactory2

extends XMLOutputFactory
implements XMLStreamProperties
Class Inheritance
All Implemented Interfaces
org.codehaus.stax2.XMLStreamProperties
Imports
java.io.Writer, javax.xml.stream.XMLEventWriter, .XMLOutputFactory, .XMLStreamException, .XMLStreamWriter, org.codehaus.stax2.io.EscapingWriterFactory

Extension of javax.xml.stream.XMLInputFactory to add missing functionality.

Also contains extended standard properties that conforming stream writer factory and instance implementations should at least recognize, and preferably support.

Note

although actual values for the property names are visible, implementations should try to use the symbolic constants defined here instead, to avoid typos.

Notes about properties that output factories should support:

Author
Tatu Saloranta ([email protected])
Version
3.0 01/21/2007

Field Summary

Modifier and TypeField and Description
public static final String
P_ATTR_VALUE_ESCAPER

Property that can be set if a custom output escaping for attribute value content is needed.

public static final String
P_AUTO_CLOSE_OUTPUT

Whether stream writer is to close the underlying output destination (output stream, reader) when stream writer is closed.

public static final String
P_AUTOMATIC_EMPTY_ELEMENTS

Whether stream writers are allowed to automatically output empty elements, when a start element is immediately followed by matching end element.

public static final String
P_AUTOMATIC_NS_PREFIX

Prefix to use for automatically created namespace prefixes, when namespace support is enabled, the writer is in "repairing" mode, and a new prefix name is needed.

public static final String
P_TEXT_ESCAPER

Property that can be set if a custom output escaping for textual content is needed.

Inherited from javax.xml.stream.XMLOutputFactory:
IS_REPAIRING_NAMESPACES

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public abstract void
configureForRobustness()

Method call to make writer be as robust as possible, that is, to make it both check AND fix problems if it can.

public abstract void
configureForSpeed()

Method call to make writer optimize its operation for speed.

public abstract void
configureForXmlConformance()

Method call to make writer be as strict with output as possible, ie maximize validation it does to try to catch any well-formedness or validity problems.

public abstract XMLEventWriter
public abstract XMLEventWriter
public abstract XMLStreamWriter2
Inherited from javax.xml.stream.XMLOutputFactory:
createXMLEventWritercreateXMLEventWritercreateXMLEventWritercreateXMLEventWritercreateXMLStreamWritercreateXMLStreamWritercreateXMLStreamWritercreateXMLStreamWritergetPropertyisPropertySupportednewDefaultFactorynewFactorynewFactorynewInstancenewInstancesetProperty

Field Detail

P_ATTR_VALUE_ESCAPERback to summary
public static final String P_ATTR_VALUE_ESCAPER

Property that can be set if a custom output escaping for attribute value content is needed. The value set needs to be of type EscapingWriterFactory. When set, the factory will be used to create a per-writer instance used to escape all attribute values written, both via explicit XMLStreamWriter#writeAttribute methods, and via copy methods (XMLStreamWriter2#copyEventFromReader).

P_AUTO_CLOSE_OUTPUTback to summary
public static final String P_AUTO_CLOSE_OUTPUT

Whether stream writer is to close the underlying output destination (output stream, reader) when stream writer is closed. Basic StAX2 specification mandates this feature to be set to false by default (for destinations that are passed by the application and for which it has access to).

Note

if set to true, writers are also allowed (but not required) to close the underlying destination when they do not need it any more, for example when throwing an (unrecoverable) exception

P_AUTOMATIC_EMPTY_ELEMENTSback to summary
public static final String P_AUTOMATIC_EMPTY_ELEMENTS

Whether stream writers are allowed to automatically output empty elements, when a start element is immediately followed by matching end element. If true, will output empty elements; if false, will always create separate end element (unless a specific method that produces empty elements is called).

Default value for implementations should be 'true'; both values should be recognized, and 'false' must be honored. However, 'true' value is only a suggestion, and need not be implemented (since there is the explicit 'writeEmptyElement()' method).

P_AUTOMATIC_NS_PREFIXback to summary
public static final String P_AUTOMATIC_NS_PREFIX

Prefix to use for automatically created namespace prefixes, when namespace support is enabled, the writer is in "repairing" mode, and a new prefix name is needed. The value is a String, and needs to be a valid namespace prefix in itself, as defined by the namespace specification. Will be prepended by a trailing part (often a sequence number), in order to make it unique to be usable as a temporary non-colliding prefix.

P_TEXT_ESCAPERback to summary
public static final String P_TEXT_ESCAPER

Property that can be set if a custom output escaping for textual content is needed. The value set needs to be of type EscapingWriterFactory. When set, the factory will be used to create a per-writer instance used to escape all textual content written, both via explicit XMLStreamWriter#writeCharacters methods, and via copy methods (XMLStreamWriter2#copyEventFromReader).

Constructor Detail

XMLOutputFactory2back to summary
protected XMLOutputFactory2()

Method Detail

configureForRobustnessback to summary
public abstract void configureForRobustness()

Method call to make writer be as robust as possible, that is, to make it both check AND fix problems if it can.

Like configureForXmlConformance, this configuration adds some overhead to output process.

None of currently defined standard properties should be affected, but implementations are likely to enable/disable custom properties related to validation.

configureForSpeedback to summary
public abstract void configureForSpeed()

Method call to make writer optimize its operation for speed. This generally disably additional checks (if any) writer does, and is likely to disable many things that configureForXmlConformance (and configureForRobustness) enables.

None of currently defined standard properties should be affected.

configureForXmlConformanceback to summary
public abstract void configureForXmlConformance()

Method call to make writer be as strict with output as possible, ie maximize validation it does to try to catch any well-formedness or validity problems.

This configuration does add some overhead to output process, since it enables content checks that are overhead.

None of currently defined standard properties should be affected, but implementations are likely to enable/disable custom properties related to validation.

createXMLEventWriterback to summary
public abstract XMLEventWriter createXMLEventWriter(Writer w, String encoding) throws XMLStreamException
createXMLEventWriterback to summary
public abstract XMLEventWriter createXMLEventWriter(XMLStreamWriter sw) throws XMLStreamException
createXMLStreamWriterback to summary
public abstract XMLStreamWriter2 createXMLStreamWriter(Writer w, String encoding) throws XMLStreamException