Interface StAXParserConfiguration

public interface StAXParserConfiguration

Defines a particular StAX parser configuration. An implementation of this interface must satisfy the following requirements:

  1. It MUST be immutable.
  2. It MUST either be a singleton or properly implement Object.equals(Object) and Object.hashCode().
These two requirements ensure that instances of this interface may be used as cache keys.

See Also:

Field Summary
static StAXParserConfiguration DEFAULT
          The default configuration.
static StAXParserConfiguration NON_COALESCING
          Configuration that sets up the parser in non coalescing mode.
static StAXParserConfiguration PRESERVE_CDATA_SECTIONS
          Configuration that sets up the parser to preserve CDATA sections.
static StAXParserConfiguration SOAP
          Configuration suitable for SOAP messages.
static StAXParserConfiguration STANDALONE
          Configuration that forces the parser to process the XML document as standalone.
Method Summary
 XMLInputFactory configure(XMLInputFactory factory, StAXDialect dialect)
          Apply the configuration to the given factory.

Field Detail


static final StAXParserConfiguration DEFAULT
The default configuration.


static final StAXParserConfiguration STANDALONE
Configuration that forces the parser to process the XML document as standalone. In this configuration, the parser will ignore any references to external entities, in particular DTDs. This is especially useful to process documents referencing DTDs with system IDs that are network locations, because parsing these documents would otherwise fail on nodes detached from the network. This configuration should be used with care because the resulting representation of the document may be incomplete. E.g. default attribute values defined in the DTD will not be reported.


static final StAXParserConfiguration NON_COALESCING
Configuration that sets up the parser in non coalescing mode.


static final StAXParserConfiguration PRESERVE_CDATA_SECTIONS
Configuration that sets up the parser to preserve CDATA sections. This configuration will also put the parser in non coalescing mode.


static final StAXParserConfiguration SOAP
Configuration suitable for SOAP messages. This will configure the parser to throw an exception when it encounters a document type declaration. The SOAP 1.1 specification indeed prescribes that "A SOAP message MUST NOT contain a Document Type Declaration." The difference between the STANDALONE configuration and this configuration is that with STANDALONE, the parser silently ignores references to external entities but doesn't throw any exception.

See Also:
Method Detail


XMLInputFactory configure(XMLInputFactory factory,
                          StAXDialect dialect)
Apply the configuration to the given factory. The method MAY optionally wrap the factory, e.g. to modify the behavior of the XMLStreamReader instances created by the factory.

factory - the factory to configure
dialect - The dialect of the StAX implementation as detected by StAXDialectDetector. The implementation may use this information to configure implementation specific settings.
The configured factory. This may be the original factory (if the implementation only changes the factory properties), or a wrapper.

Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.