SAXParserFactory

public abstract class SAXParserFactory extends Object

Defines a factory API that enables applications to configure and obtain a SAX based parser to parse XML documents.

Protected Constructor Summary

SAXParserFactory()

Protected constructor to force use of newInstance().

Public Method Summary

abstract boolean
getFeature(String name)

Returns the particular property requested for in the underlying implementation of org.xml.sax.XMLReader.

Schema
getSchema()
Gets the Schema object specified through the setSchema(Schema) method.
boolean
isNamespaceAware()
Indicates whether or not the factory is configured to produce parsers which are namespace aware.
boolean
isValidating()
Indicates whether or not the factory is configured to produce parsers which validate the XML content during parse.
boolean
isXIncludeAware()

Get state of XInclude processing.

static SAXParserFactory
newInstance(String factoryClassName, ClassLoader classLoader)
Returns an instance of the named implementation of SAXParserFactory.
static SAXParserFactory
newInstance()
Returns Android's implementation of SAXParserFactory.
abstract SAXParser
newSAXParser()

Creates a new instance of a SAXParser using the currently configured factory parameters.

abstract void
setFeature(String name, boolean value)

Sets the particular feature in the underlying implementation of org.xml.sax.XMLReader.

void
setNamespaceAware(boolean awareness)
Specifies that the parser produced by this code will provide support for XML namespaces.
void
setSchema(Schema schema)

Set the Schema to be used by parsers created from this factory.

void
setValidating(boolean validating)
Specifies that the parser produced by this code will validate documents as they are parsed.
void
setXIncludeAware(boolean state)

Set state of XInclude processing.

Inherited Method Summary

Protected Constructors

protected SAXParserFactory ()

Protected constructor to force use of newInstance().

Public Methods

public abstract boolean getFeature (String name)

Returns the particular property requested for in the underlying implementation of org.xml.sax.XMLReader.

Parameters
name The name of the property to be retrieved.
Returns
  • Value of the requested property.
Throws
ParserConfigurationException if a parser cannot be created which satisfies the requested configuration.
SAXNotRecognizedException When the underlying XMLReader does not recognize the property name.
SAXNotSupportedException When the underlying XMLReader recognizes the property name but doesn't support the property.

public Schema getSchema ()

Gets the Schema object specified through the setSchema(Schema) method.

Returns
Throws
UnsupportedOperationException For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.

public boolean isNamespaceAware ()

Indicates whether or not the factory is configured to produce parsers which are namespace aware.

Returns
  • true if the factory is configured to produce parsers which are namespace aware; false otherwise.

public boolean isValidating ()

Indicates whether or not the factory is configured to produce parsers which validate the XML content during parse.

Returns
  • true if the factory is configured to produce parsers which validate the XML content during parse; false otherwise.

public boolean isXIncludeAware ()

Get state of XInclude processing.

Returns
  • current state of XInclude processing
Throws
UnsupportedOperationException For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.

public static SAXParserFactory newInstance (String factoryClassName, ClassLoader classLoader)

Returns an instance of the named implementation of SAXParserFactory.

Parameters