Most visited

Recently visited

Added in API level 1

XmlPullParserFactory

public class XmlPullParserFactory
extends Object

java.lang.Object
   ↳ org.xmlpull.v1.XmlPullParserFactory


This class is used to create implementations of XML Pull Parser defined in XMPULL V1 API.

See also:

Summary

Constants

String PROPERTY_NAME

Fields

protected String classNamesLocation

Unused, but we have to keep it because it's public API.

protected HashMap<StringBoolean> features

protected ArrayList parserClasses

protected ArrayList serializerClasses

Protected constructors

XmlPullParserFactory()

Protected constructor to be called by factory implementations.

Public methods

boolean getFeature(String name)

Return the current value of the feature with given name.

boolean isNamespaceAware()

Indicates whether or not the factory is configured to produce parsers which are namespace aware (it simply set feature XmlPullParser.FEATURE_PROCESS_NAMESPACES to true or false).

boolean isValidating()

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

static XmlPullParserFactory newInstance()

Creates a new instance of a PullParserFactory that can be used to create XML pull parsers.

static XmlPullParserFactory newInstance(String unused, Class unused2)

Creates a factory that always returns instances of Android's built-in XmlPullParser and XmlSerializer implementation.

XmlPullParser newPullParser()

Creates a new instance of a XML Pull Parser using the currently configured factory features.

XmlSerializer newSerializer()

Creates a new instance of a XML Serializer.

void setFeature(String name, boolean state)

Set the features to be set when XML Pull Parser is created by this factory.

void setNamespaceAware(boolean awareness)

Specifies that the parser produced by this factory will provide support for XML namespaces.

void setValidating(boolean validating)

Specifies that the parser produced by this factory will be validating (it simply set feature XmlPullParser.FEATURE_VALIDATION to true or false).

Inherited methods

From class java.lang.Object

Constants

PROPERTY_NAME

Added in API level 1
String PROPERTY_NAME

Constant Value: "org.xmlpull.v1.XmlPullParserFactory"

Fields

classNamesLocation

Added in API level 1
String classNamesLocation

Unused, but we have to keep it because it's public API.

features

Added in API level 1
HashMap<StringBoolean> features

parserClasses

Added in API level 1
ArrayList parserClasses

serializerClasses

Added in API level 1
ArrayList serializerClasses

Protected constructors

XmlPullParserFactory

Added in API level 1
XmlPullParserFactory ()

Protected constructor to be called by factory implementations.

Public methods

getFeature

Added in API level 1
boolean getFeature (String name)

Return the current value of the feature with given name.

NOTE: factory features are not used for XML Serializer.

Parameters
name String: The name of feature to be retrieved.
Returns
boolean The value of named feature. Unknown features are always returned as false

isNamespaceAware

Added in API level 1
boolean isNamespaceAware ()

Indicates whether or not the factory is configured to produce parsers which are namespace aware (it simply set feature XmlPullParser.FEATURE_PROCESS_NAMESPACES to true or false).

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

isValidating

Added in API level 1
boolean isValidating ()

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

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

newInstance

Added in API level 1
XmlPullParserFactory newInstance ()

Creates a new instance of a PullParserFactory that can be used to create XML pull parsers. The factory will always return instances of Android's built-in XmlPullParser and XmlSerializer.

Returns
XmlPullParserFactory
Throws
XmlPullParserException

newInstance

Added in API level 1
XmlPullParserFactory newInstance (String unused, 
                Class unused2)

Creates a factory that always returns instances of Android's built-in XmlPullParser and XmlSerializer implementation. This does not support factories capable of creating arbitrary parser and serializer implementations. Both arguments to this method are unused.

Parameters
unused String
unused2 Class
Returns
XmlPullParserFactory
Throws
XmlPullParserException

newPullParser

Added in API level 1
XmlPullParser newPullParser ()

Creates a new instance of a XML Pull Parser using the currently configured factory features.

Returns
XmlPullParser A new instance of a XML Pull Parser.
Throws
XmlPullParserException

newSerializer

Added in API level 1
XmlSerializer newSerializer ()

Creates a new instance of a XML Serializer.

NOTE: factory features are not used for XML Serializer.

Returns
XmlSerializer A new instance of a XML Serializer.
Throws
XmlPullParserException if a parser cannot be created which satisfies the requested configuration.

setFeature

Added in API level 1
void setFeature (String name, 
                boolean state)

Set the features to be set when XML Pull Parser is created by this factory.

NOTE: factory features are not used for XML Serializer.

Parameters
name String: string with URI identifying feature
state boolean: if true feature will be set; if false will be ignored
Throws
XmlPullParserException

setNamespaceAware

Added in API level 1
void setNamespaceAware (boolean awareness)

Specifies that the parser produced by this factory will provide support for XML namespaces. By default the value of this is set to false.

Parameters
awareness boolean: true if the parser produced by this code will provide support for XML namespaces; false otherwise.

setValidating

Added in API level 1
void setValidating (boolean validating)

Specifies that the parser produced by this factory will be validating (it simply set feature XmlPullParser.FEATURE_VALIDATION to true or false). By default the value of this is set to false.

Parameters
validating boolean: - if true the parsers created by this factory must be validating.

Hooray!