| Property Name | Behavior | Return type | Default Value | Required | 
|---|---|---|---|---|
| javax.xml.stream.isValidating | Turns on/off implementation specific DTD validation | Boolean | False | No | 
| javax.xml.stream.isNamespaceAware | Turns on/off namespace processing for XML 1.0 support | Boolean | True | True (required) / False (optional) | 
| javax.xml.stream.isCoalescing | Requires the processor to coalesce adjacent character data | Boolean | False | Yes | 
| javax.xml.stream.isReplacingEntityReferences | replace internal entity references with their replacement text and report them as characters | Boolean | True | Yes | 
| javax.xml.stream.isSupportingExternalEntities | Resolve external parsed entities | Boolean | Unspecified | Yes | 
| javax.xml.stream.supportDTD | Use this property to request processors that do not support DTDs | Boolean | True | Yes | 
| javax.xml.stream.reporter | sets/gets the impl of the XMLReporter | javax.xml.stream.XMLReporter | Null | Yes | 
| javax.xml.stream.resolver | sets/gets the impl of the XMLResolver interface | javax.xml.stream.XMLResolver | Null | Yes | 
| javax.xml.stream.allocator | sets/gets the impl of the XMLEventAllocator interface | javax.xml.stream.util.XMLEventAllocator | Null | Yes | 
- Since:
- 1.6
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringThe property used to set/get the implementation of the allocatorstatic final StringThe property that requires the parser to coalesce adjacent character data sectionsstatic final StringThe property used to turn on/off namespace support, this is to support XML 1.0 documents, only the true setting must be supportedstatic final StringRequires the parser to replace internal entity references with their replacement text and report them as charactersstatic final StringThe property that requires the parser to resolve external parsed entitiesstatic final StringThe property used to turn on/off implementation specific validationstatic final StringThe property used to set/get the implementation of the XMLReporter interfacestatic final StringThe property used to set/get the implementation of the XMLResolverstatic final StringThe property that requires the parser to support DTDs
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedProtected constructor to prevent instantiation.
- 
Method SummaryModifier and TypeMethodDescriptionabstract XMLEventReadercreateFilteredReader(XMLEventReader reader, EventFilter filter) Create a filtered event reader that wraps the filter around the event readerabstract XMLStreamReadercreateFilteredReader(XMLStreamReader reader, StreamFilter filter) Create a filtered reader that wraps the filter around the readerabstract XMLEventReadercreateXMLEventReader(InputStream stream) Create a new XMLEventReader from a java.io.InputStreamabstract XMLEventReadercreateXMLEventReader(InputStream stream, String encoding) Create a new XMLEventReader from a java.io.InputStreamabstract XMLEventReadercreateXMLEventReader(Reader reader) Create a new XMLEventReader from a reader.abstract XMLEventReadercreateXMLEventReader(String systemId, InputStream stream) Create a new XMLEventReader from a java.io.InputStreamabstract XMLEventReadercreateXMLEventReader(String systemId, Reader reader) Create a new XMLEventReader from a reader.abstract XMLEventReadercreateXMLEventReader(XMLStreamReader reader) Create a new XMLEventReader from an XMLStreamReader.abstract XMLEventReadercreateXMLEventReader(Source source) Create a new XMLEventReader from a JAXP source.abstract XMLStreamReadercreateXMLStreamReader(InputStream stream) Create a new XMLStreamReader from a java.io.InputStream.abstract XMLStreamReadercreateXMLStreamReader(InputStream stream, String encoding) Create a new XMLStreamReader from a java.io.InputStream.abstract XMLStreamReadercreateXMLStreamReader(Reader reader) Create a new XMLStreamReader from a reader.abstract XMLStreamReadercreateXMLStreamReader(String systemId, InputStream stream) Create a new XMLStreamReader from a java.io.InputStream.abstract XMLStreamReadercreateXMLStreamReader(String systemId, Reader reader) Create a new XMLStreamReader from a java.io.InputStream.abstract XMLStreamReadercreateXMLStreamReader(Source source) Create a new XMLStreamReader from a JAXP source.abstract XMLEventAllocatorGets the allocator used by streams created with this factoryabstract ObjectgetProperty(String name) Get the value of a feature/property from the underlying implementationabstract XMLReporterThe reporter that will be set on any XMLStreamReader or XMLEventReader created by this factory instance.abstract XMLResolverThe resolver that will be set on any XMLStreamReader or XMLEventReader created by this factory instance.abstract booleanisPropertySupported(String name) Query the set of properties that this factory supports.static XMLInputFactoryCreates a new instance of theXMLInputFactorybuiltin system-default implementation.static XMLInputFactoryCreates a new instance of the factory.static XMLInputFactorynewFactory(String factoryId, ClassLoader classLoader) Create a new instance of the factory.static XMLInputFactoryCreates a new instance of the factory in exactly the same manner as thenewFactory()method.static XMLInputFactorynewInstance(String factoryId, ClassLoader classLoader) Deprecated.This method has been deprecated to maintain API consistency.abstract voidsetEventAllocator(XMLEventAllocator allocator) Set a user defined event allocator for eventsabstract voidsetProperty(String name, Object value) Allows the user to set specific feature/property on the underlying implementation.abstract voidsetXMLReporter(XMLReporter reporter) The reporter that will be set on any XMLStreamReader or XMLEventReader created by this factory instance.abstract voidsetXMLResolver(XMLResolver resolver) The resolver that will be set on any XMLStreamReader or XMLEventReader created by this factory instance.
- 
Field Details- 
IS_NAMESPACE_AWAREThe property used to turn on/off namespace support, this is to support XML 1.0 documents, only the true setting must be supported- See Also:
 
- 
IS_VALIDATINGThe property used to turn on/off implementation specific validation- See Also:
 
- 
IS_COALESCINGThe property that requires the parser to coalesce adjacent character data sections- See Also:
 
- 
IS_REPLACING_ENTITY_REFERENCESRequires the parser to replace internal entity references with their replacement text and report them as characters- See Also:
 
- 
IS_SUPPORTING_EXTERNAL_ENTITIESThe property that requires the parser to resolve external parsed entities- See Also:
 
- 
SUPPORT_DTDThe property that requires the parser to support DTDs- See Also:
 
- 
REPORTERThe property used to set/get the implementation of the XMLReporter interface- See Also:
 
- 
RESOLVERThe property used to set/get the implementation of the XMLResolver- See Also:
 
- 
ALLOCATORThe property used to set/get the implementation of the allocator- See Also:
 
 
- 
- 
Constructor Details- 
XMLInputFactoryprotected XMLInputFactory()Protected constructor to prevent instantiation. UsenewFactory()instead.
 
- 
- 
Method Details- 
newDefaultFactoryCreates a new instance of theXMLInputFactorybuiltin system-default implementation.- Returns:
- A new instance of the XMLInputFactorybuiltin system-default implementation.
- Since:
- 9
 
- 
newInstanceCreates a new instance of the factory in exactly the same manner as thenewFactory()method.- Returns:
- an instance of the XMLInputFactory
- Throws:
- FactoryConfigurationError- if an instance of this factory cannot be loaded
 
- 
newFactoryCreates a new instance of the factory. This method uses the JAXP Lookup Mechanism to determine theXMLInputFactoryimplementation class to load.Once an application has obtained a reference to a XMLInputFactory, it can use the factory to configure and obtain stream instances.- Returns:
- an instance of the XMLInputFactory
- Throws:
- FactoryConfigurationError- in case of service configuration error or if the implementation is not available or cannot be instantiated.
 
- 
newInstance@Deprecated(since="1.7") public static XMLInputFactory newInstance(String factoryId, ClassLoader classLoader) throws FactoryConfigurationError Deprecated.This method has been deprecated to maintain API consistency. All newInstance methods have been replaced with corresponding newFactory methods. The replacementnewFactory(java.lang.String, java.lang.ClassLoader)method defines no changes in behavior.Create a new instance of the factory.- Parameters:
- factoryId- Name of the factory to find, same as a property name
- classLoader- classLoader to use
- Returns:
- the factory implementation
- Throws:
- FactoryConfigurationError- if an instance of this factory cannot be loaded
 
- 
newFactorypublic static XMLInputFactory newFactory(String factoryId, ClassLoader classLoader) throws FactoryConfigurationError Create a new instance of the factory. If the classLoader argument is null, then the ContextClassLoader is used.This method uses the following ordered lookup procedure to determine the XMLInputFactory implementation class to load: - 
   Use the value of the system property identified by factoryId.
- 
   Use the configuration file "stax.properties". The file is in standard Propertiesformat and typically located in theconfdirectory of the Java installation. It contains the fully qualified name of the implementation class with the key being the system property defined above.The stax.properties file is read only once by the implementation and its values are then cached for future use. If the file does not exist when the first attempt is made to read from it, no further attempts are made to check for its existence. It is not possible to change the value of any property in stax.properties after it has been read for the first time. Use the jaxp configuration file "jaxp.properties". The file is in the same format as stax.properties and will only be read if stax.properties does not exist. 
- 
   If factoryIdis "javax.xml.stream.XMLInputFactory", use the service-provider loading facility, defined by theServiceLoaderclass, to attempt to locate and load an implementation of the service using the specifiedClassLoader. IfclassLoaderis null, the default loading mechanism will apply: That is, the service-provider loading facility will use the current thread's context class loader to attempt to load the service. If the context class loader is null, the system class loader will be used.
- 
   Otherwise, throws a FactoryConfigurationError.
 Note that this is a new method that replaces the deprecated newInstance(String factoryId, ClassLoader classLoader)method. No changes in behavior are defined by this replacement method relative to the deprecated method.- API Note:
- The parameter factoryId defined here is inconsistent with that of other JAXP factories where the first parameter is fully qualified factory class name that provides implementation of the factory.
- Parameters:
- factoryId- Name of the factory to find, same as a property name
- classLoader- classLoader to use
- Returns:
- the factory implementation
- Throws:
- FactoryConfigurationError- in case of service configuration error or if the implementation is not available or cannot be instantiated.
- FactoryConfigurationError- if an instance of this factory cannot be loaded
 
- 
   
- 
createXMLStreamReaderCreate a new XMLStreamReader from a reader.- Parameters:
- reader- the XML data to read from
- Returns:
- an instance of the XMLStreamReader
- Throws:
- XMLStreamException- if an error occurs
 
- 
createXMLStreamReaderCreate a new XMLStreamReader from a JAXP source. This method is optional.- Parameters:
- source- the source to read from
- Returns:
- an instance of the XMLStreamReader
- Throws:
- UnsupportedOperationException- if this method is not supported by this XMLInputFactory
- XMLStreamException- if an error occurs
 
- 
createXMLStreamReaderCreate a new XMLStreamReader from a java.io.InputStream.- Parameters:
- stream- the InputStream to read from
- Returns:
- an instance of the XMLStreamReader
- Throws:
- XMLStreamException- if an error occurs
 
- 
createXMLStreamReaderpublic abstract XMLStreamReader createXMLStreamReader(InputStream stream, String encoding) throws XMLStreamException Create a new XMLStreamReader from a java.io.InputStream.- Parameters:
- stream- the InputStream to read from
- encoding- the character encoding of the stream
- Returns:
- an instance of the XMLStreamReader
- Throws:
- XMLStreamException- if an error occurs
 
- 
createXMLStreamReaderpublic abstract XMLStreamReader createXMLStreamReader(String systemId, InputStream stream) throws XMLStreamException Create a new XMLStreamReader from a java.io.InputStream.- Parameters:
- systemId- the system ID of the stream
- stream- the InputStream to read from
- Returns:
- an instance of the XMLStreamReader
- Throws:
- XMLStreamException- if an error occurs
 
- 
createXMLStreamReaderpublic abstract XMLStreamReader createXMLStreamReader(String systemId, Reader reader) throws XMLStreamException Create a new XMLStreamReader from a java.io.InputStream.- Parameters:
- systemId- the system ID of the stream
- reader- the InputStream to read from
- Returns:
- an instance of the XMLStreamReader
- Throws:
- XMLStreamException- if an error occurs
 
- 
createXMLEventReaderCreate a new XMLEventReader from a reader.- Parameters:
- reader- the XML data to read from
- Returns:
- an instance of the XMLEventReader
- Throws:
- XMLStreamException- if an error occurs
 
- 
createXMLEventReaderpublic abstract XMLEventReader createXMLEventReader(String systemId, Reader reader) throws XMLStreamException Create a new XMLEventReader from a reader.- Parameters:
- systemId- the system ID of the input
- reader- the XML data to read from
- Returns:
- an instance of the XMLEventReader
- Throws:
- XMLStreamException- if an error occurs
 
- 
createXMLEventReaderpublic abstract XMLEventReader createXMLEventReader(XMLStreamReader reader) throws XMLStreamException Create a new XMLEventReader from an XMLStreamReader. After being used to construct the XMLEventReader instance returned from this method the XMLStreamReader must not be used.- Parameters:
- reader- the XMLStreamReader to read from (may not be modified)
- Returns:
- a new XMLEventReader
- Throws:
- XMLStreamException- if an error occurs
 
- 
createXMLEventReaderCreate a new XMLEventReader from a JAXP source. Support of this method is optional.- Parameters:
- source- the source to read from
- Returns:
- an instance of the XMLEventReader
- Throws:
- XMLStreamException- if an error occurs
- UnsupportedOperationException- if this method is not supported by this XMLInputFactory
 
- 
createXMLEventReaderCreate a new XMLEventReader from a java.io.InputStream- Parameters:
- stream- the InputStream to read from
- Returns:
- an instance of the XMLEventReader
- Throws:
- XMLStreamException- if an error occurs
 
- 
createXMLEventReaderpublic abstract XMLEventReader createXMLEventReader(InputStream stream, String encoding) throws XMLStreamException Create a new XMLEventReader from a java.io.InputStream- Parameters:
- stream- the InputStream to read from
- encoding- the character encoding of the stream
- Returns:
- an instance of the XMLEventReader
- Throws:
- XMLStreamException- if an error occurs
 
- 
createXMLEventReaderpublic abstract XMLEventReader createXMLEventReader(String systemId, InputStream stream) throws XMLStreamException Create a new XMLEventReader from a java.io.InputStream- Parameters:
- systemId- the system ID of the stream
- stream- the InputStream to read from
- Returns:
- an instance of the XMLEventReader
- Throws:
- XMLStreamException- if an error occurs
 
- 
createFilteredReaderpublic abstract XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter) throws XMLStreamException Create a filtered reader that wraps the filter around the reader- Parameters:
- reader- the reader to filter
- filter- the filter to apply to the reader
- Returns:
- an instance of the XMLEventReader
- Throws:
- XMLStreamException- if an error occurs
 
- 
createFilteredReaderpublic abstract XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter) throws XMLStreamException Create a filtered event reader that wraps the filter around the event reader- Parameters:
- reader- the event reader to wrap
- filter- the filter to apply to the event reader
- Returns:
- an instance of the XMLEventReader
- Throws:
- XMLStreamException- if an error occurs
 
- 
getXMLResolverThe resolver that will be set on any XMLStreamReader or XMLEventReader created by this factory instance.- Returns:
- an instance of the XMLResolver
 
- 
setXMLResolverThe resolver that will be set on any XMLStreamReader or XMLEventReader created by this factory instance.- Parameters:
- resolver- the resolver to use to resolve references
 
- 
getXMLReporterThe reporter that will be set on any XMLStreamReader or XMLEventReader created by this factory instance.- Returns:
- an instance of the XMLReporter
 
- 
setXMLReporterThe reporter that will be set on any XMLStreamReader or XMLEventReader created by this factory instance.- Parameters:
- reporter- the resolver to use to report non fatal errors
 
- 
setPropertyAllows the user to set specific feature/property on the underlying implementation. The underlying implementation is not required to support every setting of every property in the specification and may use IllegalArgumentException to signal that an unsupported property may not be set with the specified value.All implementations that implement JAXP 1.5 or newer are required to support the XMLConstants.ACCESS_EXTERNAL_DTDproperty.- 
        Access to external DTDs, external Entity References is restricted to the protocols specified by the property. If access is denied during parsing due to the restriction of this property, XMLStreamExceptionwill be thrown by theXMLStreamReader.next()orXMLEventReader.nextEvent()method.
 - Parameters:
- name- The name of the property (may not be null)
- value- The value of the property
- Throws:
- IllegalArgumentException- if the property is not supported
 
- 
        
- 
getPropertyGet the value of a feature/property from the underlying implementation- Parameters:
- name- The name of the property (may not be null)
- Returns:
- The value of the property
- Throws:
- IllegalArgumentException- if the property is not supported
 
- 
isPropertySupportedQuery the set of properties that this factory supports.- Parameters:
- name- The name of the property (may not be null)
- Returns:
- true if the property is supported and false otherwise
 
- 
setEventAllocatorSet a user defined event allocator for events- Parameters:
- allocator- the user defined allocator
 
- 
getEventAllocatorGets the allocator used by streams created with this factory- Returns:
- an instance of the XMLEventAllocator
 
 
-