javax.xml.stream
Class XMLInputFactory

java.lang.Object
  extended byjavax.xml.stream.XMLInputFactory

public abstract class XMLInputFactory
extends 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.isValidating Turns on/off implementation specific DTD validation BooleanFalse 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 charactersBoolean 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 BooleanTrue Yes
javax.xml.stream.resolver sets/gets the impl of the XMLResolver interface javax.xml.stream.XMLResolver Null Yes

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

Field Summary
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 RESOLVER
           
static String SUPPORT_DTD
          The property that requires the parser to support DTDs
 
Constructor Summary
protected XMLInputFactory()
           
 
Method Summary
abstract  XMLStreamReader createXMLStreamReader(InputStream stream)
          Create a new XMLStreamReader from a java.io.InputStream
abstract  XMLStreamReader createXMLStreamReader(InputStream stream, String encoding)
          Create a new XMLStreamReader from a java.io.InputStream
abstract  XMLStreamReader createXMLStreamReader(Reader reader)
          Create a new XMLStreamReader from a reader
abstract  Object getProperty(String name)
          Get the value of a feature/property from the underlying implementation
abstract  XMLResolver getXMLResolver()
          The resolver that will be set on any XMLStreamReader created by this factory instance.
abstract  boolean isPropertySupported(String name)
          Query the set of properties that this factory supports.
static XMLInputFactory newInstance()
          Create a new instance of the factory.
abstract  void setProperty(String name, Object value)
          Allows the user to set specific feature/property on the underlying implementation.
abstract  void setXMLResolver(XMLResolver resolver)
          The resolver that will be set on any XMLStreamReader created by this factory instance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IS_NAMESPACE_AWARE

public static final 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 String IS_VALIDATING
The property used to turn on/off implementation specific validation

See Also:
Constant Field Values

IS_COALESCING

public static final 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 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 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 String SUPPORT_DTD
The property that requires the parser to support DTDs

See Also:
Constant Field Values

RESOLVER

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

createXMLStreamReader

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

Parameters:
reader - the XML data to read from, may not be null
Throws:
XMLStreamException

createXMLStreamReader

public abstract XMLStreamReader createXMLStreamReader(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(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
Throws:
XMLStreamException

getXMLResolver

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


setXMLResolver

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

Parameters:
resolver - the resolver to use to resolve references

setProperty

public abstract void setProperty(String name,
                                 Object value)
                          throws 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 a property is unsupported, or that the specified 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:
IllegalArgumentException - if the property is not supported

getProperty

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

isPropertySupported

public abstract boolean isPropertySupported(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


Copyright © 2003,2007 BEA Systems. All rights reserved. See the Copyright Notice for details.