javax.xml.stream
Class XMLInputFactory

java.lang.Object
  extended by javax.xml.stream.XMLInputFactory

public abstract class XMLInputFactory
extends java.lang.Object

Defines an abstract implementation of a factory for getting streams. The following table defines the standard properties of this specification. Each property varies in the level of support required by each implementation. The level of support required is described in the 'Required' column.

Configuration parameters
Property Name Behavior Return type Default Value Required
javax.xml.stream.isValidatingTurns on/off implementation specific DTD validationBooleanFalseNo
javax.xml.stream.isNamespaceAwareTurns on/off namespace processing for XML 1.0 supportBooleanTrueTrue (required) / False (optional)
javax.xml.stream.isCoalescingRequires the processor to coalesce adjacent character dataBooleanFalseYes
javax.xml.stream.isReplacingEntityReferencesreplace internal entity references with their replacement text and report them as charactersBooleanTrueYes
javax.xml.stream.isSupportingExternalEntitiesResolve external parsed entitiesBooleanUnspecifiedYes
javax.xml.stream.supportDTDUse this property to request processors that do not support DTDsBooleanTrueYes
javax.xml.stream.reportersets/gets the impl of the XMLReporter javax.xml.stream.XMLReporterNullYes
javax.xml.stream.resolversets/gets the impl of the XMLResolver interfacejavax.xml.stream.XMLResolverNullYes
javax.xml.stream.allocatorsets/gets the impl of the XMLEventAllocator interfacejavax.xml.stream.util.XMLEventAllocatorNullYes

Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.
See Also:
XMLOutputFactory, XMLEventReader, XMLStreamReader, EventFilter, XMLReporter, XMLResolver, XMLEventAllocator

Field Summary
static java.lang.String ALLOCATOR
          The property used to set/get the implementation of the allocator
static java.lang.String IS_COALESCING
          The property that requires the parser to coalesce adjacent character data sections
static java.lang.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 java.lang.String IS_REPLACING_ENTITY_REFERENCES
          Requires the parser to replace internal entity references with their replacement text and report them as characters
static java.lang.String IS_SUPPORTING_EXTERNAL_ENTITIES
          The property that requires the parser to resolve external parsed entities
static java.lang.String IS_VALIDATING
          The property used to turn on/off implementation specific validation
static java.lang.String REPORTER
          The property used to set/get the implementation of the XMLReporter interface
static java.lang.String RESOLVER
          The property used to set/get the implementation of the XMLResolver
static java.lang.String SUPPORT_DTD
          The property that requires the parser to support DTDs
 
Constructor Summary
protected XMLInputFactory()
           
 
Method Summary
abstract  XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter)
          Create a filtered event reader that wraps the filter around the event reader
abstract  XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter)
          Create a filtered reader that wraps the filter around the reader
abstract  XMLEventReader createXMLEventReader(java.io.InputStream stream)
          Create a new XMLEventReader from a java.io.InputStream
abstract  XMLEventReader createXMLEventReader(java.io.InputStream stream, java.lang.String encoding)
          Create a new XMLEventReader from a java.io.InputStream
abstract  XMLEventReader createXMLEventReader(java.io.Reader reader)
          Create a new XMLEventReader from a reader
abstract  XMLEventReader createXMLEventReader(javax.xml.transform.Source source)
          Create a new XMLEventReader from a JAXP source.
abstract  XMLEventReader createXMLEventReader(java.lang.String systemId, java.io.InputStream stream)
          Create a new XMLEventReader from a java.io.InputStream
abstract  XMLEventReader createXMLEventReader(java.lang.String systemId, java.io.Reader reader)
          Create a new XMLEventReader from a reader
abstract  XMLEventReader createXMLEventReader(XMLStreamReader reader)
          Create a new XMLEventReader from an XMLStreamReader.
abstract  XMLStreamReader createXMLStreamReader(java.io.InputStream stream)
          Create a new XMLStreamReader from a java.io.InputStream
abstract  XMLStreamReader createXMLStreamReader(java.io.InputStream stream, java.lang.String encoding)
          Create a new XMLStreamReader from a java.io.InputStream
abstract  XMLStreamReader createXMLStreamReader(java.io.Reader reader)
          Create a new XMLStreamReader from a reader
abstract  XMLStreamReader createXMLStreamReader(javax.xml.transform.Source source)
          Create a new XMLStreamReader from a JAXP source.
abstract  XMLStreamReader createXMLStreamReader(java.lang.String systemId, java.io.InputStream stream)
          Create a new XMLStreamReader from a java.io.InputStream
abstract  XMLStreamReader createXMLStreamReader(java.lang.String systemId, java.io.Reader reader)
          Create a new XMLStreamReader from a java.io.InputStream
abstract  XMLEventAllocator getEventAllocator()
          Gets the allocator used by streams created with this factory
abstract  java.lang.Object getProperty(java.lang.String name)
          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(java.lang.String name)
          Query the set of properties that this factory supports.
static XMLInputFactory newInstance()
          Create a new instance of the factory.
static XMLInputFactory newInstance(java.lang.String factoryId, java.lang.ClassLoader classLoader)
          Create a new instance of the factory
abstract  void setEventAllocator(XMLEventAllocator allocator)
          Set a user defined event allocator for events
abstract  void setProperty(java.lang.String name, java.lang.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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IS_NAMESPACE_AWARE

public static final java.lang.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

See Also:
Constant Field Values

IS_VALIDATING

public static final java.lang.String IS_VALIDATING
The property used to turn on/off implementation specific validation

See Also:
Constant Field Values

IS_COALESCING

public static final java.lang.String IS_COALESCING
The property that requires the parser to coalesce adjacent character data sections

See Also:
Constant Field Values

IS_REPLACING_ENTITY_REFERENCES

public static final java.lang.String 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

IS_SUPPORTING_EXTERNAL_ENTITIES

public static final java.lang.String IS_SUPPORTING_EXTERNAL_ENTITIES
The property that requires the parser to resolve external parsed entities

See Also:
Constant Field Values

SUPPORT_DTD

public static final java.lang.String SUPPORT_DTD
The property that requires the parser to support DTDs

See Also:
Constant Field Values

REPORTER

public static final java.lang.String REPORTER
The property used to set/get the implementation of the XMLReporter interface

See Also:
Constant Field Values

RESOLVER

public static final java.lang.String RESOLVER
The property used to set/get the implementation of the XMLResolver

See Also:
Constant Field Values

ALLOCATOR

public static final java.lang.String ALLOCATOR
The property used to set/get the implementation of the allocator

See Also:
Constant Field Values
Constructor Detail

XMLInputFactory

protected XMLInputFactory()
Method Detail

newInstance

public static XMLInputFactory newInstance()
                                   throws FactoryConfigurationError
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 properties file "lib/stax.properties" in the JRE directory. This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above. Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API will look for a classname in the file META-INF/services/javax.xml.stream.XMLInputFactory in jars available to the runtime. Platform default XMLInputFactory instance. Once an application has obtained a reference to a XMLInputFactory it can use the factory to configure and obtain stream instances.

Throws:
FactoryConfigurationError - if an instance of this factory cannot be loaded

newInstance

public static XMLInputFactory newInstance(java.lang.String factoryId,
                                          java.lang.ClassLoader classLoader)
                                   throws FactoryConfigurationError
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

createXMLStreamReader

public abstract XMLStreamReader createXMLStreamReader(java.io.Reader reader)
                                               throws XMLStreamException
Create a new XMLStreamReader from a reader

Parameters:
reader - the XML data to read from
Throws:
XMLStreamException

createXMLStreamReader

public abstract XMLStreamReader createXMLStreamReader(javax.xml.transform.Source source)
                                               throws XMLStreamException
Create a new XMLStreamReader from a JAXP source. This method is optional.

Parameters:
source - the source to read from
Throws:
java.lang.UnsupportedOperationException - if this method is not supported by this XMLInputFactory
XMLStreamException

createXMLStreamReader

public abstract XMLStreamReader createXMLStreamReader(java.io.InputStream stream)
                                               throws XMLStreamException
Create a new XMLStreamReader from a java.io.InputStream

Parameters:
stream - the InputStream to read from
Throws:
XMLStreamException

createXMLStreamReader

public abstract XMLStreamReader createXMLStreamReader(java.io.InputStream stream,
                                                      java.lang.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
Throws:
XMLStreamException

createXMLStreamReader

public abstract XMLStreamReader createXMLStreamReader(java.lang.String systemId,
                                                      java.io.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
Throws:
XMLStreamException

createXMLStreamReader

public abstract XMLStreamReader createXMLStreamReader(java.lang.String systemId,
                                                      java.io.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
Throws:
XMLStreamException

createXMLEventReader

public abstract XMLEventReader createXMLEventReader(java.io.Reader reader)
                                             throws XMLStreamException
Create a new XMLEventReader from a reader

Parameters:
reader - the XML data to read from
Throws:
XMLStreamException

createXMLEventReader

public abstract XMLEventReader createXMLEventReader(java.lang.String systemId,
                                                    java.io.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
Throws:
XMLStreamException

createXMLEventReader

public 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

createXMLEventReader

public abstract XMLEventReader createXMLEventReader(javax.xml.transform.Source source)
                                             throws XMLStreamException
Create a new XMLEventReader from a JAXP source. Support of this method is optional.

Parameters:
source - the source to read from
Throws:
java.lang.UnsupportedOperationException - if this method is not supported by this XMLInputFactory
XMLStreamException

createXMLEventReader

public abstract XMLEventReader createXMLEventReader(java.io.InputStream stream)
                                             throws XMLStreamException
Create a new XMLEventReader from a java.io.InputStream

Parameters:
stream - the InputStream to read from
Throws:
XMLStreamException

createXMLEventReader

public abstract XMLEventReader createXMLEventReader(java.io.InputStream stream,
                                                    java.lang.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
Throws:
XMLStreamException

createXMLEventReader

public abstract XMLEventReader createXMLEventReader(java.lang.String systemId,
                                                    java.io.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
Throws:
XMLStreamException

createFilteredReader

public 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
Throws:
XMLStreamException

createFilteredReader

public 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
Throws:
XMLStreamException

getXMLResolver

public abstract XMLResolver getXMLResolver()
The resolver that will be set on any XMLStreamReader or XMLEventReader created by this factory instance.


setXMLResolver

public abstract void setXMLResolver(XMLResolver 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 getXMLReporter()
The reporter that will be set on any XMLStreamReader or XMLEventReader created by this factory instance.


setXMLReporter

public abstract void setXMLReporter(XMLReporter 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(java.lang.String name,
                                 java.lang.Object value)
                          throws java.lang.IllegalArgumentException
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.

Parameters:
name - The name of the property (may not be null)
value - The value of the property
Throws:
java.lang.IllegalArgumentException - if the property is not supported

getProperty

public abstract java.lang.Object getProperty(java.lang.String name)
                                      throws java.lang.IllegalArgumentException
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:
java.lang.IllegalArgumentException - if the property is not supported

isPropertySupported

public abstract boolean isPropertySupported(java.lang.String 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 allocator)
Set a user defined event allocator for events

Parameters:
allocator - the user defined allocator

getEventAllocator

public abstract XMLEventAllocator getEventAllocator()
Gets the allocator used by streams created with this factory



Submit a bug or feature

Copyright © 2009, 2010, Oracle Corporation and/or its affiliates. All Rights Reserved. Use is subject to license terms.

Generated on 4-June-2010 04:34