XMLInputFactory (Java SE 9 & JDK 9 ) (original) (raw)
Field Detail
* #### IS\_NAMESPACE\_AWARE
public static final [String](../../../java/lang/String.html "class in java.lang") 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
See Also:
[Constant Field Values](../../../constant-values.html#javax.xml.stream.XMLInputFactory.IS%5FNAMESPACE%5FAWARE)
* #### IS\_VALIDATING
public static final [String](../../../java/lang/String.html "class in java.lang") IS_VALIDATING
The property used to turn on/off implementation specific validation
See Also:
[Constant Field Values](../../../constant-values.html#javax.xml.stream.XMLInputFactory.IS%5FVALIDATING)
* #### IS\_COALESCING
public static final [String](../../../java/lang/String.html "class in java.lang") IS_COALESCING
The property that requires the parser to coalesce adjacent character data sections
See Also:
[Constant Field Values](../../../constant-values.html#javax.xml.stream.XMLInputFactory.IS%5FCOALESCING)
* #### IS\_REPLACING\_ENTITY\_REFERENCES
public static final [String](../../../java/lang/String.html "class in java.lang") IS_REPLACING_ENTITY_REFERENCES
Requires the parser to replace internal entity references with their replacement text and report them as characters
See Also:
[Constant Field Values](../../../constant-values.html#javax.xml.stream.XMLInputFactory.IS%5FREPLACING%5FENTITY%5FREFERENCES)
* #### IS\_SUPPORTING\_EXTERNAL\_ENTITIES
public static final [String](../../../java/lang/String.html "class in java.lang") IS_SUPPORTING_EXTERNAL_ENTITIES
The property that requires the parser to resolve external parsed entities
See Also:
[Constant Field Values](../../../constant-values.html#javax.xml.stream.XMLInputFactory.IS%5FSUPPORTING%5FEXTERNAL%5FENTITIES)
* #### SUPPORT\_DTD
public static final [String](../../../java/lang/String.html "class in java.lang") SUPPORT_DTD
The property that requires the parser to support DTDs
See Also:
[Constant Field Values](../../../constant-values.html#javax.xml.stream.XMLInputFactory.SUPPORT%5FDTD)
* #### REPORTER
public static final [String](../../../java/lang/String.html "class in java.lang") REPORTER
The property used to set/get the implementation of the XMLReporter interface
See Also:
[Constant Field Values](../../../constant-values.html#javax.xml.stream.XMLInputFactory.REPORTER)
* #### RESOLVER
public static final [String](../../../java/lang/String.html "class in java.lang") RESOLVER
The property used to set/get the implementation of the XMLResolver
See Also:
[Constant Field Values](../../../constant-values.html#javax.xml.stream.XMLInputFactory.RESOLVER)
* #### ALLOCATOR
public static final [String](../../../java/lang/String.html "class in java.lang") ALLOCATOR
The property used to set/get the implementation of the allocator
See Also:
[Constant Field Values](../../../constant-values.html#javax.xml.stream.XMLInputFactory.ALLOCATOR)
* #### newDefaultFactory
public static [XMLInputFactory](../../../javax/xml/stream/XMLInputFactory.html "class in javax.xml.stream") newDefaultFactory()
Creates a new instance of the `XMLInputFactory` builtin system-default implementation.
Returns:
A new instance of the `XMLInputFactory` builtin system-default implementation.
Since:
9
* #### newInstance
public static [XMLInputFactory](../../../javax/xml/stream/XMLInputFactory.html "class in javax.xml.stream") newInstance()
throws [FactoryConfigurationError](../../../javax/xml/stream/FactoryConfigurationError.html "class in javax.xml.stream")
Creates a new instance of the factory in exactly the same manner as the[newFactory()](../../../javax/xml/stream/XMLInputFactory.html#newFactory--) method.
Throws:
`[FactoryConfigurationError](../../../javax/xml/stream/FactoryConfigurationError.html "class in javax.xml.stream")` \- if an instance of this factory cannot be loaded
* #### newFactory
[@Deprecated](../../../java/lang/Deprecated.html "annotation in java.lang")([since](../../../java/lang/Deprecated.html#since--)="1.7")
public static [XMLInputFactory](../../../javax/xml/stream/XMLInputFactory.html "class in javax.xml.stream") newFactory()
throws [FactoryConfigurationError](../../../javax/xml/stream/FactoryConfigurationError.html "class in javax.xml.stream")
Deprecated.
Create a new instance of the factory.
This static method creates a new factory instance. This method uses the following ordered lookup procedure to determine the XMLInputFactory implementation class to load:
* Use the javax.xml.stream.XMLInputFactory system property.
* Use the configuration file "stax.properties". The file is in standard[Properties](../../../java/util/Properties.html "class in java.util") format and typically located in the`conf` directory 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.
* Use the service-provider loading facility, defined by the[ServiceLoader](../../../java/util/ServiceLoader.html "class in java.util") class, to attempt to locate and load an implementation of the service using the [default loading mechanism](../../../java/util/ServiceLoader.html#load-java.lang.Class-): the service-provider loading facility will use the [current thread's context class loader](../../../java/lang/Thread.html#getContextClassLoader--) to attempt to load the service. If the context class loader is null, the [system class loader](../../../java/lang/ClassLoader.html#getSystemClassLoader--) will be used.
* Otherwise, the [system-default](../../../javax/xml/stream/XMLInputFactory.html#newDefaultFactory--) implementation is returned.
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.
Throws:
`[FactoryConfigurationError](../../../javax/xml/stream/FactoryConfigurationError.html "class in javax.xml.stream")` \- in case of [service configuration error](../../../java/util/ServiceConfigurationError.html "class in java.util") or if the implementation is not available or cannot be instantiated.
* #### newInstance
[@Deprecated](../../../java/lang/Deprecated.html "annotation in java.lang")([since](../../../java/lang/Deprecated.html#since--)="1.7")
public static [XMLInputFactory](../../../javax/xml/stream/XMLInputFactory.html "class in javax.xml.stream") newInstance([String](../../../java/lang/String.html "class in java.lang") factoryId,
[ClassLoader](../../../java/lang/ClassLoader.html "class in java.lang") classLoader)
throws [FactoryConfigurationError](../../../javax/xml/stream/FactoryConfigurationError.html "class in javax.xml.stream")
Deprecated.
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](../../../javax/xml/stream/FactoryConfigurationError.html "class in javax.xml.stream")` \- if an instance of this factory cannot be loaded
* #### newFactory
public static [XMLInputFactory](../../../javax/xml/stream/XMLInputFactory.html "class in javax.xml.stream") newFactory([String](../../../java/lang/String.html "class in java.lang") factoryId,
[ClassLoader](../../../java/lang/ClassLoader.html "class in java.lang") classLoader)
throws [FactoryConfigurationError](../../../javax/xml/stream/FactoryConfigurationError.html "class in javax.xml.stream")
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[Properties](../../../java/util/Properties.html "class in java.util") format and typically located in the`conf` directory 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 `factoryId` is "javax.xml.stream.XMLInputFactory", use the service-provider loading facility, defined by the[ServiceLoader](../../../java/util/ServiceLoader.html "class in java.util") class, to attempt to [locate and load](../../../java/util/ServiceLoader.html#load-java.lang.Class-java.lang.ClassLoader-) an implementation of the service using the specified `ClassLoader`. If `classLoader` is null, the [default loading mechanism](../../../java/util/ServiceLoader.html#load-java.lang.Class-) will apply: That is, the service-provider loading facility will use the [current thread's context class loader](../../../java/lang/Thread.html#getContextClassLoader--) to attempt to load the service. If the context class loader is null, the [system class loader](../../../java/lang/ClassLoader.html#getSystemClassLoader--) will be used.
* Otherwise, throws a [FactoryConfigurationError](../../../javax/xml/stream/FactoryConfigurationError.html "class in javax.xml.stream").
Note that this is a new method that replaces the deprecated[newInstance(String factoryId, ClassLoader classLoader)](../../../javax/xml/stream/XMLInputFactory.html#newInstance-java.lang.String-java.lang.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](../../../javax/xml/stream/FactoryConfigurationError.html "class in javax.xml.stream")` \- in case of [service configuration error](../../../java/util/ServiceConfigurationError.html "class in java.util") or if the implementation is not available or cannot be instantiated.
`[FactoryConfigurationError](../../../javax/xml/stream/FactoryConfigurationError.html "class in javax.xml.stream")` \- if an instance of this factory cannot be loaded
* #### createXMLStreamReader
public abstract [XMLStreamReader](../../../javax/xml/stream/XMLStreamReader.html "interface in javax.xml.stream") createXMLStreamReader([Reader](../../../java/io/Reader.html "class in java.io") reader)
throws [XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")
Create a new XMLStreamReader from a reader
Parameters:
`reader` \- the XML data to read from
Throws:
`[XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")`
* #### createXMLStreamReader
public abstract [XMLStreamReader](../../../javax/xml/stream/XMLStreamReader.html "interface in javax.xml.stream") createXMLStreamReader([Source](../../../javax/xml/transform/Source.html "interface in javax.xml.transform") source)
throws [XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")
Create a new XMLStreamReader from a JAXP source. This method is optional.
Parameters:
`source` \- the source to read from
Throws:
`[UnsupportedOperationException](../../../java/lang/UnsupportedOperationException.html "class in java.lang")` \- if this method is not supported by this XMLInputFactory
`[XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")`
* #### createXMLStreamReader
public abstract [XMLStreamReader](../../../javax/xml/stream/XMLStreamReader.html "interface in javax.xml.stream") createXMLStreamReader([InputStream](../../../java/io/InputStream.html "class in java.io") stream)
throws [XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")
Create a new XMLStreamReader from a java.io.InputStream
Parameters:
`stream` \- the InputStream to read from
Throws:
`[XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")`
* #### createXMLStreamReader
public abstract [XMLStreamReader](../../../javax/xml/stream/XMLStreamReader.html "interface in javax.xml.stream") createXMLStreamReader([InputStream](../../../java/io/InputStream.html "class in java.io") stream,
[String](../../../java/lang/String.html "class in java.lang") encoding)
throws [XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")
Create a new XMLStreamReader from a java.io.InputStream
Parameters:
`stream` \- the InputStream to read from
`encoding` \- the character encoding of the stream
Throws:
`[XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")`
* #### createXMLStreamReader
public abstract [XMLStreamReader](../../../javax/xml/stream/XMLStreamReader.html "interface in javax.xml.stream") createXMLStreamReader([String](../../../java/lang/String.html "class in java.lang") systemId,
[InputStream](../../../java/io/InputStream.html "class in java.io") stream)
throws [XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")
Create a new XMLStreamReader from a java.io.InputStream
Parameters:
`systemId` \- the system ID of the stream
`stream` \- the InputStream to read from
Throws:
`[XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")`
* #### createXMLStreamReader
public abstract [XMLStreamReader](../../../javax/xml/stream/XMLStreamReader.html "interface in javax.xml.stream") createXMLStreamReader([String](../../../java/lang/String.html "class in java.lang") systemId,
[Reader](../../../java/io/Reader.html "class in java.io") reader)
throws [XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")
Create a new XMLStreamReader from a java.io.InputStream
Parameters:
`systemId` \- the system ID of the stream
`reader` \- the InputStream to read from
Throws:
`[XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")`
* #### createXMLEventReader
public abstract [XMLEventReader](../../../javax/xml/stream/XMLEventReader.html "interface in javax.xml.stream") createXMLEventReader([Reader](../../../java/io/Reader.html "class in java.io") reader)
throws [XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")
Create a new XMLEventReader from a reader
Parameters:
`reader` \- the XML data to read from
Throws:
`[XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")`
* #### createXMLEventReader
public abstract [XMLEventReader](../../../javax/xml/stream/XMLEventReader.html "interface in javax.xml.stream") createXMLEventReader([String](../../../java/lang/String.html "class in java.lang") systemId,
[Reader](../../../java/io/Reader.html "class in java.io") reader)
throws [XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")
Create a new XMLEventReader from a reader
Parameters:
`systemId` \- the system ID of the input
`reader` \- the XML data to read from
Throws:
`[XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")`
* #### createXMLEventReader
public abstract [XMLEventReader](../../../javax/xml/stream/XMLEventReader.html "interface in javax.xml.stream") createXMLEventReader([XMLStreamReader](../../../javax/xml/stream/XMLStreamReader.html "interface in javax.xml.stream") reader)
throws [XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")
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](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")`
* #### createXMLEventReader
public abstract [XMLEventReader](../../../javax/xml/stream/XMLEventReader.html "interface in javax.xml.stream") createXMLEventReader([Source](../../../javax/xml/transform/Source.html "interface in javax.xml.transform") source)
throws [XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")
Create a new XMLEventReader from a JAXP source. Support of this method is optional.
Parameters:
`source` \- the source to read from
Throws:
`[UnsupportedOperationException](../../../java/lang/UnsupportedOperationException.html "class in java.lang")` \- if this method is not supported by this XMLInputFactory
`[XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")`
* #### createXMLEventReader
public abstract [XMLEventReader](../../../javax/xml/stream/XMLEventReader.html "interface in javax.xml.stream") createXMLEventReader([InputStream](../../../java/io/InputStream.html "class in java.io") stream)
throws [XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")
Create a new XMLEventReader from a java.io.InputStream
Parameters:
`stream` \- the InputStream to read from
Throws:
`[XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")`
* #### createXMLEventReader
public abstract [XMLEventReader](../../../javax/xml/stream/XMLEventReader.html "interface in javax.xml.stream") createXMLEventReader([InputStream](../../../java/io/InputStream.html "class in java.io") stream,
[String](../../../java/lang/String.html "class in java.lang") encoding)
throws [XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")
Create a new XMLEventReader from a java.io.InputStream
Parameters:
`stream` \- the InputStream to read from
`encoding` \- the character encoding of the stream
Throws:
`[XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")`
* #### createXMLEventReader
public abstract [XMLEventReader](../../../javax/xml/stream/XMLEventReader.html "interface in javax.xml.stream") createXMLEventReader([String](../../../java/lang/String.html "class in java.lang") systemId,
[InputStream](../../../java/io/InputStream.html "class in java.io") stream)
throws [XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")
Create a new XMLEventReader from a java.io.InputStream
Parameters:
`systemId` \- the system ID of the stream
`stream` \- the InputStream to read from
Throws:
`[XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")`
* #### createFilteredReader
public abstract [XMLStreamReader](../../../javax/xml/stream/XMLStreamReader.html "interface in javax.xml.stream") createFilteredReader([XMLStreamReader](../../../javax/xml/stream/XMLStreamReader.html "interface in javax.xml.stream") reader,
[StreamFilter](../../../javax/xml/stream/StreamFilter.html "interface in javax.xml.stream") filter)
throws [XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")
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
Throws:
`[XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")`
* #### createFilteredReader
public abstract [XMLEventReader](../../../javax/xml/stream/XMLEventReader.html "interface in javax.xml.stream") createFilteredReader([XMLEventReader](../../../javax/xml/stream/XMLEventReader.html "interface in javax.xml.stream") reader,
[EventFilter](../../../javax/xml/stream/EventFilter.html "interface in javax.xml.stream") filter)
throws [XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")
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
Throws:
`[XMLStreamException](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream")`
* #### getXMLResolver
public abstract [XMLResolver](../../../javax/xml/stream/XMLResolver.html "interface in javax.xml.stream") getXMLResolver()
The resolver that will be set on any XMLStreamReader or XMLEventReader created by this factory instance.
* #### setXMLResolver
public abstract void setXMLResolver([XMLResolver](../../../javax/xml/stream/XMLResolver.html "interface in javax.xml.stream") resolver)
The resolver that will be set on any XMLStreamReader or XMLEventReader created by this factory instance.
Parameters:
`resolver` \- the resolver to use to resolve references
* #### getXMLReporter
public abstract [XMLReporter](../../../javax/xml/stream/XMLReporter.html "interface in javax.xml.stream") getXMLReporter()
The reporter that will be set on any XMLStreamReader or XMLEventReader created by this factory instance.
* #### setXMLReporter
public abstract void setXMLReporter([XMLReporter](../../../javax/xml/stream/XMLReporter.html "interface in javax.xml.stream") reporter)
The 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
* #### setProperty
public abstract void setProperty([String](../../../java/lang/String.html "class in java.lang") name,
[Object](../../../java/lang/Object.html "class in java.lang") value)
throws [IllegalArgumentException](../../../java/lang/IllegalArgumentException.html "class in java.lang")
Allows 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\_DTD](../../../javax/xml/XMLConstants.html#ACCESS%5FEXTERNAL%5FDTD) 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](../../../javax/xml/stream/XMLStreamException.html "class in javax.xml.stream") will be thrown by the [XMLStreamReader.next()](../../../javax/xml/stream/XMLStreamReader.html#next--) or[XMLEventReader.nextEvent()](../../../javax/xml/stream/XMLEventReader.html#nextEvent--) method.
Parameters:
`name` \- The name of the property (may not be null)
`value` \- The value of the property
Throws:
`[IllegalArgumentException](../../../java/lang/IllegalArgumentException.html "class in java.lang")` \- if the property is not supported
* #### getProperty
public abstract [Object](../../../java/lang/Object.html "class in java.lang") getProperty([String](../../../java/lang/String.html "class in java.lang") name)
throws [IllegalArgumentException](../../../java/lang/IllegalArgumentException.html "class in java.lang")
Get 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](../../../java/lang/IllegalArgumentException.html "class in java.lang")` \- if the property is not supported
* #### isPropertySupported
public abstract boolean isPropertySupported([String](../../../java/lang/String.html "class in java.lang") name)
Query 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
* #### setEventAllocator
public abstract void setEventAllocator([XMLEventAllocator](../../../javax/xml/stream/util/XMLEventAllocator.html "interface in javax.xml.stream.util") allocator)
Set a user defined event allocator for events
Parameters:
`allocator` \- the user defined allocator
* #### getEventAllocator
public abstract [XMLEventAllocator](../../../javax/xml/stream/util/XMLEventAllocator.html "interface in javax.xml.stream.util") getEventAllocator()
Gets the allocator used by streams created with this factory