Android
javax.xml.parsers
public abstract class

javax.xml.parsers.SAXParserFactory

java.lang.Object
javax.xml.parsers.SAXParserFactory

Provides a factory for SAXParser instances. The class first needs to be instantiated using the newInstance() method. The instance can be configured as desired. A call to newSAXParser() then provides a SAXParser instance matching this configuration.

Summary

Protected Constructors

            SAXParserFactory()
Do-nothing constructor.

Public Methods

abstract          boolean  getFeature(String name)
Queries a feature from the underlying implementation.
          boolean  isNamespaceAware()
Queries whether the factory is configured to deliver parsers that are namespace-aware.
          boolean  isValidating()
Queries whether the factory is configured to deliver parsers that are validating.
          boolean  isXIncludeAware()
Queries whether the factory is configured to deliver parsers that are XInclude-aware.
      static    SAXParserFactory  newInstance()
Creates a new SAXParserFactory that can be configured and then be used for creating SAXPArser objects.
abstract          SAXParser  newSAXParser()
Creates a new SAXParser that matches the current configuration.
abstract          void  setFeature(String name, boolean value)
Sets a feature in the underlying implementation.
          void  setNamespaceAware(boolean value)
Determines whether the factory is configured to deliver parsers that are namespace-aware.
          void  setValidating(boolean value)
Determines whether the factory is configured to deliver parsers that are validating.
          void  setXIncludeAware(boolean value)
Determines whether the factory is configured to deliver parsers that are XInclude-aware.
Methods inherited from class java.lang.Object

Details

Protected Constructors

protected SAXParserFactory()

Do-nothing constructor. Prevents instantiation. To be overridden by concrete subclasses.

Public Methods

public abstract boolean getFeature(String name)

Queries a feature from the underlying implementation.

Parameters

name The name of the feature. The default Android implementation of SAXParser supports only the following two features:
http://xml.org/sax/features/namespaces
Queries the state of namespace-awareness.
http://xml.org/sax/features/namespaces
Queries the state of validation.
Note that despite the ability to query the validation feature, there is currently no validating parser available.

Returns

  • The status of the feature.

Throws

ParserConfigurationException if no SAXParser matching the given criteria is available.
SAXNotRecognizedException If the given feature is not known to the underlying implementation.
SAXNotSupportedException If the given features is known, but not supported by the underlying implementation.

public boolean isNamespaceAware()

Queries whether the factory is configured to deliver parsers that are namespace-aware.

Returns

  • true if namespace-awareness is desired, false otherwise.

public boolean isValidating()

Queries whether the factory is configured to deliver parsers that are validating.

Returns

  • true if validating is desired, false otherwise.

public boolean isXIncludeAware()

Queries whether the factory is configured to deliver parsers that are XInclude-aware.

Returns

  • true if XInclude-awareness is desired, false otherwise.

public static SAXParserFactory newInstance()

Creates a new SAXParserFactory that can be configured and then be used for creating SAXPArser objects.

Returns

  • The SAXParserFactory.

Throws

FactoryConfigurationError If no SAXParserFactory can be created.

public abstract SAXParser newSAXParser()

Creates a new SAXParser that matches the current configuration.

Returns

  • The SAXParser.

Throws

ParserConfigurationException if no matching SAXParser could be found.
SAXException If a problem occurs during SAX parsing.

public abstract void setFeature(String name, boolean value)

Sets a feature in the underlying implementation.

Parameters

name The name of the feature. The default Android implementation of SAXParser supports only the following two features:
http://xml.org/sax/features/namespaces
Turns namespace-awareness on or off.
http://xml.org/sax/features/namespaces
Turns validation on or off.
Note that despite the ability to set the validation feature, there is currently no validating parser available.
value The status of the feature.

Throws

ParserConfigurationException if no SAXParser matching the given criteria is available.
SAXNotRecognizedException If the given feature is not known to the underlying implementation.
SAXNotSupportedException If the given features is known, but not supported by the underlying implementation.

public void setNamespaceAware(boolean value)

Determines whether the factory is configured to deliver parsers that are namespace-aware.

Parameters

value Turns namespace-awareness on or off.

public void setValidating(boolean value)

Determines whether the factory is configured to deliver parsers that are validating.

Parameters

value Turns validation on or off.

public void setXIncludeAware(boolean value)

Determines whether the factory is configured to deliver parsers that are XInclude-aware.

Parameters

value Turns XInclude-awareness on or off.
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56