public abstract class XMLInputFactory extends Object
| Configuration parameters | ||||
|---|---|---|---|---|
| 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 |
XMLOutputFactory,
XMLEventReader,
XMLStreamReader,
EventFilter,
XMLReporter,
XMLResolver,
XMLEventAllocator
| Modifier and Type | Field and Description |
|---|---|
static String |
ALLOCATOR
The property used to set/get the implementation of the allocator
|
static String |
IS_COALESCING
The property that requires the parser to coalesce adjacent character data sections
|
static String |
IS_NAMESPACE_AWARE
The property used to turn on/off namespace support, this is to support XML 1.0 documents, only the true setting must be supported
|
static String |
IS_REPLACING_ENTITY_REFERENCES
Requires the parser to replace internal entity references with their replacement text and report them as characters
|
static String |
IS_SUPPORTING_EXTERNAL_ENTITIES
The property that requires the parser to resolve external parsed entities
|
static String |
IS_VALIDATING
The property used to turn on/off implementation specific validation
|
static String |
REPORTER
The property used to set/get the implementation of the XMLReporter interface
|
static String |
RESOLVER
The property used to set/get the implementation of the XMLResolver
|
static String |
SUPPORT_DTD
The property that requires the parser to support DTDs
|
| Modifier | Constructor and Description |
|---|---|
protected |
XMLInputFactory()
|
| Modifier and Type | Method and Description |
|---|---|
abstract XMLEventReader |
createFilteredReader(XMLEventReader
Create a filtered event reader that wraps the filter around the event reader
|
abstract XMLStreamReader |
createFilteredReader(XMLStreamReader
Create a filtered reader that wraps the filter around the reader
|
abstract XMLEventReader |
createXMLEventReader(InputStream
Create a new XMLEventReader from a java.io.InputStream
|
abstract XMLEventReader |
createXMLEventReader(InputStream
Create a new XMLEventReader from a java.io.InputStream
|
abstract XMLEventReader |
createXMLEventReader(Reader
Create a new XMLEventReader from a reader
|
abstract XMLEventReader |
createXMLEventReader(Source
Create a new XMLEventReader from a JAXP source.
|
abstract XMLEventReader |
createXMLEventReader(String
Create a new XMLEventReader from a java.io.InputStream
|
abstract XMLEventReader |
createXMLEventReader(String
Create a new XMLEventReader from a reader
|
abstract XMLEventReader |
createXMLEventReader(XMLStreamReader
Create a new XMLEventReader from an XMLStreamReader.
|
abstract XMLStreamReader |
createXMLStreamReader(InputStream
Create a new XMLStreamReader from a java.io.InputStream
|
abstract XMLStreamReader |
createXMLStreamReader(InputStream
Create a new XMLStreamReader from a java.io.InputStream
|
abstract XMLStreamReader |
createXMLStreamReader(Reader
Create a new XMLStreamReader from a reader
|
abstract XMLStreamReader |
createXMLStreamReader(Source
Create a new XMLStreamReader from a JAXP source.
|
abstract XMLStreamReader |
createXMLStreamReader(String
Create a new XMLStreamReader from a java.io.InputStream
|
abstract XMLStreamReader |
createXMLStreamReader(String
Create a new XMLStreamReader from a java.io.InputStream
|
abstract XMLEventAllocator |
getEventAllocator()
Gets the allocator used by streams created with this factory
|
abstract Object |
getProperty(String
Get the value of a feature/property from the underlying implementation
|
abstract XMLReporter |
getXMLReporter()
The reporter that will be set on any XMLStreamReader or XMLEventReader created by this factory instance.
|
abstract XMLResolver |
getXMLResolver()
The resolver that will be set on any XMLStreamReader or XMLEventReader created by this factory instance.
|
abstract boolean |
isPropertySupported(String
Query the set of properties that this factory supports.
|
static XMLInputFactory |
newFactory()
Create a new instance of the factory.
|
static XMLInputFactory |
newFactory(String
Create a new instance of the factory.
|
static XMLInputFactory |
newInstance()
Creates a new instance of the factory in exactly the same manner as the
newFactory() method.
|
static XMLInputFactory |
newInstance(String
Deprecated.
This method has been deprecated to maintain API consistency. All newInstance methods have been replaced with corresponding newFactory methods. The replacement
newFactory(java.lang.String, java.lang.ClassLoader) method defines no changes in behavior.
|
abstract void |
setEventAllocator(XMLEventAllocator
Set a user defined event allocator for events
|
abstract void |
setProperty(String
Allows the user to set specific feature/property on the underlying implementation.
|
abstract void |
setXMLReporter(XMLReporter
The reporter that will be set on any XMLStreamReader or XMLEventReader created by this factory instance.
|
abstract void |
setXMLResolver(XMLResolver
The resolver that will be set on any XMLStreamReader or XMLEventReader created by this factory instance.
|
public static final StringIS_NAMESPACE_AWARE
public static final StringIS_VALIDATING
public static final StringIS_COALESCING
public static final StringIS_REPLACING_ENTITY_REFERENCES
public static final StringIS_SUPPORTING_EXTERNAL_ENTITIES
public static final StringSUPPORT_DTD
public static final StringREPORTER
public static final StringRESOLVER
public static final StringALLOCATOR
public static XMLInputFactorynewInstance() throws FactoryConfigurationError
newFactory() method.
FactoryConfigurationError - if an instance of this factory cannot be loaded
public static XMLInputFactorynewFactory() throws FactoryConfigurationError
This static method creates a new factory instance. This method uses the following ordered lookup procedure to determine the XMLInputFactory implementation class to load:
ServiceLoader class, to attempt to locate and load an implementation of the service using the default loading mechanism: 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. Once an application has obtained a reference to a XMLInputFactory it can use the factory to configure and obtain stream instances.
Note that this is a new method that replaces the deprecated newInstance() method. No changes in behavior are defined by this replacement method relative to the deprecated method.
FactoryConfigurationError - in case of
service configuration error or if the implementation is not available or cannot be instantiated.
public static XMLInputFactorynewInstance(String factoryId, ClassLoader classLoader) throws FactoryConfigurationError
newFactory(java.lang.String, java.lang.ClassLoader) method defines no changes in behavior.
factoryId - Name of the factory to find, same as a property name
classLoader - classLoader to use
FactoryConfigurationError - if an instance of this factory cannot be loaded
public static XMLInputFactorynewFactory(String factoryId, ClassLoader classLoader) throws FactoryConfigurationError
This method uses the following ordered lookup procedure to determine the XMLInputFactory implementation class to load:
factoryId. factoryId. factoryId is "javax.xml.stream.XMLInputFactory", use the service-provider loading facilities, defined by the ServiceLoader class, to attempt to locate and load an implementation of the service using the specified ClassLoader. If classLoader is 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. 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.
factoryId - Name of the factory to find, same as a property name
classLoader - classLoader to use
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
public abstract XMLStreamReadercreateXMLStreamReader(Reader reader) throws XMLStreamException
reader - the XML data to read from
XMLStreamException -
public abstract XMLStreamReadercreateXMLStreamReader(Source source) throws XMLStreamException
source - the source to read from
UnsupportedOperationException - if this method is not supported by this XMLInputFactory
XMLStreamException -
public abstract XMLStreamReadercreateXMLStreamReader(InputStream stream) throws XMLStreamException
stream - the InputStream to read from
XMLStreamException -
public abstract XMLStreamReadercreateXMLStreamReader(InputStream stream, String encoding) throws XMLStreamException
stream - the InputStream to read from
encoding - the character encoding of the stream
XMLStreamException -
public abstract XMLStreamReadercreateXMLStreamReader(String systemId, InputStream stream) throws XMLStreamException
systemId - the system ID of the stream
stream - the InputStream to read from
XMLStreamException
public abstract XMLStreamReadercreateXMLStreamReader(String systemId, Reader reader) throws XMLStreamException
systemId - the system ID of the stream
reader - the InputStream to read from
XMLStreamException
public abstract XMLEventReadercreateXMLEventReader(Reader reader) throws XMLStreamException
reader - the XML data to read from
XMLStreamException -
public abstract XMLEventReadercreateXMLEventReader(String systemId, Reader reader) throws XMLStreamException
systemId - the system ID of the input
reader - the XML data to read from
XMLStreamException -
public abstract XMLEventReadercreateXMLEventReader(XMLStreamReader reader) throws XMLStreamException
reader - the XMLStreamReader to read from (may not be modified)
XMLStreamException -
public abstract XMLEventReadercreateXMLEventReader(Source source) throws XMLStreamException
source - the source to read from
UnsupportedOperationException - if this method is not supported by this XMLInputFactory
XMLStreamException
public abstract XMLEventReadercreateXMLEventReader(InputStream stream) throws XMLStreamException
stream - the InputStream to read from
XMLStreamException -
public abstract XMLEventReadercreateXMLEventReader(InputStream stream, String encoding) throws XMLStreamException
stream - the InputStream to read from
encoding - the character encoding of the stream
XMLStreamException -
public abstract XMLEventReadercreateXMLEventReader(String systemId, InputStream stream) throws XMLStreamException
systemId - the system ID of the stream
stream - the InputStream to read from
XMLStreamException -
public abstract XMLStreamReadercreateFilteredReader(XMLStreamReader reader, StreamFilter filter) throws XMLStreamException
reader - the reader to filter
filter - the filter to apply to the reader
XMLStreamException -
public abstract XMLEventReadercreateFilteredReader(XMLEventReader reader, EventFilter filter) throws XMLStreamException
reader - the event reader to wrap
filter - the filter to apply to the event reader
XMLStreamException -
public abstract XMLResolvergetXMLResolver()
public abstract void setXMLResolver(XMLResolverresolver)
resolver - the resolver to use to resolve references
public abstract XMLReportergetXMLReporter()
public abstract void setXMLReporter(XMLReporterreporter)
reporter - the resolver to use to report non fatal errors
public abstract void setProperty(Stringname, Object value) throws IllegalArgumentException
All implementations that implement JAXP 1.5 or newer are required to support the XMLConstants property.
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, XMLStreamException will be thrown by the XMLStreamReader or XMLEventReader method.
name - The name of the property (may not be null)
value - The value of the property
IllegalArgumentException - if the property is not supported
public abstract ObjectgetProperty(String name) throws IllegalArgumentException
name - The name of the property (may not be null)
IllegalArgumentException - if the property is not supported
public abstract boolean isPropertySupported(Stringname)
name - The name of the property (may not be null)
public abstract void setEventAllocator(XMLEventAllocatorallocator)
allocator - the user defined allocator
public abstract XMLEventAllocatorgetEventAllocator()