public abstract classXMLInputFactoryextendsObject
| 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 | Description |
|---|---|---|
staticString | ALLOCATOR | The property used to set/get the implementation of the allocator |
staticString | IS_COALESCING | The property that requires the parser to coalesce adjacent character data sections |
staticString | 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 |
staticString | IS_REPLACING_ENTITY_REFERENCES | Requires the parser to replace internal entity references with their replacement text and report them as characters |
staticString | IS_SUPPORTING_EXTERNAL_ENTITIES | The property that requires the parser to resolve external parsed entities |
staticString | IS_VALIDATING | The property used to turn on/off implementation specific validation |
staticString | REPORTER | The property used to set/get the implementation of the XMLReporter interface |
staticString | RESOLVER | The property used to set/get the implementation of the XMLResolver |
staticString | SUPPORT_DTD | The property that requires the parser to support DTDs |
| Modifier | Constructor | Description |
|---|---|---|
protected | XMLInputFactory() |
| Modifier and Type | Method | Description |
|---|---|---|
abstractXMLEventReader | createFilteredReader(XMLEventReader reader,EventFilter filter) | Create a filtered event reader that wraps the filter around the event reader |
abstractXMLStreamReader | createFilteredReader(XMLStreamReader reader,StreamFilter filter) | Create a filtered reader that wraps the filter around the reader |
abstractXMLEventReader | createXMLEventReader(InputStream stream) | Create a new XMLEventReader from a java.io.InputStream |
abstractXMLEventReader | createXMLEventReader(InputStream stream,String encoding) | Create a new XMLEventReader from a java.io.InputStream |
abstractXMLEventReader | createXMLEventReader(Reader reader) | Create a new XMLEventReader from a reader |
abstractXMLEventReader | createXMLEventReader(Source source) | Create a new XMLEventReader from a JAXP source. |
abstractXMLEventReader | createXMLEventReader(String systemId,InputStream stream) | Create a new XMLEventReader from a java.io.InputStream |
abstractXMLEventReader | createXMLEventReader(String systemId,Reader reader) | Create a new XMLEventReader from a reader |
abstractXMLEventReader | createXMLEventReader(XMLStreamReader reader) | Create a new XMLEventReader from an XMLStreamReader. |
abstractXMLStreamReader | createXMLStreamReader(InputStream stream) | Create a new XMLStreamReader from a java.io.InputStream |
abstractXMLStreamReader | createXMLStreamReader(InputStream stream,String encoding) | Create a new XMLStreamReader from a java.io.InputStream |
abstractXMLStreamReader | createXMLStreamReader(Reader reader) | Create a new XMLStreamReader from a reader |
abstractXMLStreamReader | createXMLStreamReader(Source source) | Create a new XMLStreamReader from a JAXP source. |
abstractXMLStreamReader | createXMLStreamReader(String systemId,InputStream stream) | Create a new XMLStreamReader from a java.io.InputStream |
abstractXMLStreamReader | createXMLStreamReader(String systemId,Reader reader) | Create a new XMLStreamReader from a java.io.InputStream |
abstractXMLEventAllocator | getEventAllocator() | Gets the allocator used by streams created with this factory |
abstractObject | getProperty(String name) | Get the value of a feature/property from the underlying implementation |
abstractXMLReporter | getXMLReporter() | The reporter that will be set on any XMLStreamReader or XMLEventReader created by this factory instance. |
abstractXMLResolver | getXMLResolver() | The resolver that will be set on any XMLStreamReader or XMLEventReader created by this factory instance. |
abstract boolean | isPropertySupported(String name) | Query the set of properties that this factory supports. |
staticXMLInputFactory | newFactory() | Create a new instance of the factory. |
staticXMLInputFactory | newFactory(String factoryId,ClassLoader classLoader) | Create a new instance of the factory. |
staticXMLInputFactory | newInstance() | Creates a new instance of the factory in exactly the same manner as the newFactory() method. |
staticXMLInputFactory | newInstance(String factoryId,ClassLoader classLoader) | 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 allocator) | Set a user defined event allocator for events |
abstract void | setProperty(String name,Object value) | Allows the user to set specific feature/property on the underlying implementation. |
abstract void | setXMLReporter(XMLReporter reporter) | The reporter that will be set on any XMLStreamReader or XMLEventReader created by this factory instance. |
abstract void | setXMLResolver(XMLResolver resolver) | The resolver that will be set on any XMLStreamReader or XMLEventReader created by this factory instance. |
public static final String IS_NAMESPACE_AWARE
public static final String IS_VALIDATING
public static final String IS_COALESCING
public static final String IS_REPLACING_ENTITY_REFERENCES
public static final String IS_SUPPORTING_EXTERNAL_ENTITIES
public static final String SUPPORT_DTD
public static final String REPORTER
public static final String RESOLVER
public static final String ALLOCATOR
public static XMLInputFactory newInstance() throwsFactoryConfigurationError
newFactory() method.FactoryConfigurationError - if an instance of this factory cannot be loadedpublic static XMLInputFactory newFactory() throwsFactoryConfigurationError
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 thedefault loading mechanism: the service-provider loading facility will use thecurrent thread's context class loader to attempt to load the service. If the context class loader is null, thesystem 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 ofservice configuration error or if the implementation is not available or cannot be instantiated.public static XMLInputFactory newInstance(String factoryId,ClassLoader classLoader) throwsFactoryConfigurationError
newFactory(java.lang.String, java.lang.ClassLoader) method defines no changes in behavior.factoryId - Name of the factory to find, same as a property nameclassLoader - classLoader to useFactoryConfigurationError - if an instance of this factory cannot be loadedpublic static XMLInputFactory newFactory(String factoryId,ClassLoader classLoader) throwsFactoryConfigurationError
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 theServiceLoader class, to attempt tolocate and load an implementation of the service using the specifiedClassLoader. IfclassLoader is null, thedefault loading mechanism will apply: That is, the service-provider loading facility will use thecurrent thread's context class loader to attempt to load the service. If the context class loader is null, thesystem class loader will be used.FactoryConfigurationError. Note that this is a new method that replaces the deprecatednewInstance(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 nameclassLoader - classLoader to useFactoryConfigurationError - in case ofservice configuration error or if the implementation is not available or cannot be instantiated.FactoryConfigurationError - if an instance of this factory cannot be loadedpublic abstract XMLStreamReader createXMLStreamReader(Reader reader) throwsXMLStreamException
reader - the XML data to read fromXMLStreamExceptionpublic abstract XMLStreamReader createXMLStreamReader(Source source) throwsXMLStreamException
source - the source to read fromUnsupportedOperationException - if this method is not supported by this XMLInputFactoryXMLStreamExceptionpublic abstract XMLStreamReader createXMLStreamReader(InputStream stream) throwsXMLStreamException
stream - the InputStream to read fromXMLStreamExceptionpublic abstract XMLStreamReader createXMLStreamReader(InputStream stream,String encoding) throwsXMLStreamException
stream - the InputStream to read fromencoding - the character encoding of the streamXMLStreamExceptionpublic abstract XMLStreamReader createXMLStreamReader(String systemId,InputStream stream) throwsXMLStreamException
systemId - the system ID of the streamstream - the InputStream to read fromXMLStreamExceptionpublic abstract XMLStreamReader createXMLStreamReader(String systemId,Reader reader) throwsXMLStreamException
systemId - the system ID of the streamreader - the InputStream to read fromXMLStreamExceptionpublic abstract XMLEventReader createXMLEventReader(Reader reader) throwsXMLStreamException
reader - the XML data to read fromXMLStreamExceptionpublic abstract XMLEventReader createXMLEventReader(String systemId,Reader reader) throwsXMLStreamException
systemId - the system ID of the inputreader - the XML data to read fromXMLStreamExceptionpublic abstract XMLEventReader createXMLEventReader(XMLStreamReader reader) throwsXMLStreamException
reader - the XMLStreamReader to read from (may not be modified)XMLStreamExceptionpublic abstract XMLEventReader createXMLEventReader(Source source) throwsXMLStreamException
source - the source to read fromUnsupportedOperationException - if this method is not supported by this XMLInputFactoryXMLStreamExceptionpublic abstract XMLEventReader createXMLEventReader(InputStream stream) throwsXMLStreamException
stream - the InputStream to read fromXMLStreamExceptionpublic abstract XMLEventReader createXMLEventReader(InputStream stream,String encoding) throwsXMLStreamException
stream - the InputStream to read fromencoding - the character encoding of the streamXMLStreamExceptionpublic abstract XMLEventReader createXMLEventReader(String systemId,InputStream stream) throwsXMLStreamException
systemId - the system ID of the streamstream - the InputStream to read fromXMLStreamExceptionpublic abstract XMLStreamReader createFilteredReader(XMLStreamReader reader,StreamFilter filter) throwsXMLStreamException
reader - the reader to filterfilter - the filter to apply to the readerXMLStreamExceptionpublic abstract XMLEventReader createFilteredReader(XMLEventReader reader,EventFilter filter) throwsXMLStreamException
reader - the event reader to wrapfilter - the filter to apply to the event readerXMLStreamExceptionpublic abstract XMLResolver getXMLResolver()
public abstract void setXMLResolver(XMLResolver resolver)
resolver - the resolver to use to resolve referencespublic abstract XMLReporter getXMLReporter()
public abstract void setXMLReporter(XMLReporter reporter)
reporter - the resolver to use to report non fatal errorspublic abstract void setProperty(String name,Object value) throwsIllegalArgumentException
All implementations that implement JAXP 1.5 or newer are required to support theXMLConstants.ACCESS_EXTERNAL_DTD 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 theXMLStreamReader.next() orXMLEventReader.nextEvent() method.
name - The name of the property (may not be null)value - The value of the propertyIllegalArgumentException - if the property is not supportedpublic abstract Object getProperty(String name) throwsIllegalArgumentException
name - The name of the property (may not be null)IllegalArgumentException - if the property is not supportedpublic abstract boolean isPropertySupported(String name)
name - The name of the property (may not be null)public abstract void setEventAllocator(XMLEventAllocator allocator)
allocator - the user defined allocatorpublic abstract XMLEventAllocator getEventAllocator()