Package org.apache.axiom.om.util
Interface StAXParserConfiguration
public interface StAXParserConfiguration
Defines a particular StAX parser configuration. An implementation of this
interface must satisfy the following requirements:
- It MUST be immutable.
- It MUST either be a singleton or properly implement
Object.equals(Object)andObject.hashCode().
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StAXParserConfigurationThe default configuration.static final StAXParserConfigurationConfiguration that sets up the parser in non coalescing mode.static final StAXParserConfigurationConfiguration that sets up the parser to preserve CDATA sections.static final StAXParserConfigurationConfiguration that forces the parser to be secure against XML External Entity (XXE) attacks by disabling DTDs and external entities.static final StAXParserConfigurationConfiguration suitable for SOAP messages.static final StAXParserConfigurationConfiguration that forces the parser to process the XML document as standalone. -
Method Summary
Modifier and TypeMethodDescriptionconfigure(XMLInputFactory factory, StAXDialect dialect) Apply the configuration to the given factory.
-
Field Details
-
DEFAULT
The default configuration. -
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. -
NON_COALESCING
Configuration that sets up the parser in non coalescing mode. -
PRESERVE_CDATA_SECTIONS
Configuration that sets up the parser to preserve CDATA sections. This configuration will also put the parser in non coalescing mode. -
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 theSTANDALONEconfiguration and this configuration is that withSTANDALONE, the parser silently ignores references to external entities but doesn't throw any exception.- See Also:
-
SECURE
Configuration that forces the parser to be secure against XML External Entity (XXE) attacks by disabling DTDs and external entities.
-
-
Method Details
-
configure
Apply the configuration to the given factory. The method MAY optionally wrap the factory, e.g. to modify the behavior of theXMLStreamReaderinstances created by the factory.- Parameters:
factory- the factory to configuredialect- The dialect of the StAX implementation as detected byStAXDialectDetector. The implementation may use this information to configure implementation specific settings.- Returns:
- The configured factory. This may be the original factory (if the implementation only changes the factory properties), or a wrapper.
-