Package org.xmlpull.v1
Class XmlPullParserFactory
- java.lang.Object
-
- org.xmlpull.v1.XmlPullParserFactory
-
public class XmlPullParserFactory extends java.lang.ObjectThis class is used to create implementations of XML Pull Parser defined in XMPULL V1 API.- See Also:
XmlPullParser
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringclassNamesLocationUnused, but we have to keep it because it's public API.protected java.util.HashMap<java.lang.String,java.lang.Boolean>featuresprotected java.util.ArrayListparserClassesstatic java.lang.StringPROPERTY_NAMEprotected java.util.ArrayListserializerClasses
-
Constructor Summary
Constructors Modifier Constructor Description protectedXmlPullParserFactory()Protected constructor to be called by factory implementations.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetFeature(java.lang.String name)Return the current value of the feature with given name.booleanisNamespaceAware()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).booleanisValidating()Indicates whether or not the factory is configured to produce parsers which validate the XML content during parse.static XmlPullParserFactorynewInstance()Creates a new instance of a PullParserFactory that can be used to create XML pull parsers.static XmlPullParserFactorynewInstance(java.lang.String unused, java.lang.Class unused2)Creates a factory that always returns instances of Android's built-inXmlPullParserandXmlSerializerimplementation.XmlPullParsernewPullParser()Creates a new instance of a XML Pull Parser using the currently configured factory features.XmlSerializernewSerializer()Creates a new instance of a XML Serializer.voidsetFeature(java.lang.String name, boolean state)Set the features to be set when XML Pull Parser is created by this factory.voidsetNamespaceAware(boolean awareness)Specifies that the parser produced by this factory will provide support for XML namespaces.voidsetValidating(boolean validating)Specifies that the parser produced by this factory will be validating (it simply set feature XmlPullParser.FEATURE_VALIDATION to true or false).
-
-
-
Field Detail
-
PROPERTY_NAME
public static final java.lang.String PROPERTY_NAME
- See Also:
- Constant Field Values
-
parserClasses
protected java.util.ArrayList parserClasses
-
serializerClasses
protected java.util.ArrayList serializerClasses
-
classNamesLocation
protected java.lang.String classNamesLocation
Unused, but we have to keep it because it's public API.
-
features
protected java.util.HashMap<java.lang.String,java.lang.Boolean> features
-
-
Method Detail
-
setFeature
public void setFeature(java.lang.String name, boolean state) throws XmlPullParserExceptionSet 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 with URI identifying featurestate- if true feature will be set; if false will be ignored- Throws:
XmlPullParserException
-
getFeature
public boolean getFeature(java.lang.String name)
Return the current value of the feature with given name.NOTE: factory features are not used for XML Serializer.
- Parameters:
name- The name of feature to be retrieved.- Returns:
- The value of named feature.
Unknown features are
always returned as false
-
setNamespaceAware
public 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- true if the parser produced by this code will provide support for XML namespaces; false otherwise.
-
isNamespaceAware
public 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:
- true if the factory is configured to produce parsers which are namespace aware; false otherwise.
-
setValidating
public 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- - if true the parsers created by this factory must be validating.
-
isValidating
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.
-
newPullParser
public XmlPullParser newPullParser() throws XmlPullParserException
Creates a new instance of a XML Pull Parser using the currently configured factory features.- Returns:
- A new instance of a XML Pull Parser.
- Throws:
XmlPullParserException
-
newSerializer
public XmlSerializer newSerializer() throws XmlPullParserException
Creates a new instance of a XML Serializer.NOTE: factory features are not used for XML Serializer.
- Returns:
- A new instance of a XML Serializer.
- Throws:
XmlPullParserException- if a parser cannot be created which satisfies the requested configuration.
-
newInstance
public static XmlPullParserFactory newInstance() throws XmlPullParserException
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-inXmlPullParserandXmlSerializer.- Throws:
XmlPullParserException
-
newInstance
public static XmlPullParserFactory newInstance(java.lang.String unused, java.lang.Class unused2) throws XmlPullParserException
Creates a factory that always returns instances of Android's built-inXmlPullParserandXmlSerializerimplementation. This does not support factories capable of creating arbitrary parser and serializer implementations. Both arguments to this method are unused.- Throws:
XmlPullParserException
-
-