|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xmlpull.v1.XmlPullParserFactory
This class is used to create implementations of XML Pull Parser defined in XMPULL V1 API. The name of actual facotry class will be determied based on several parameters. It works similar to JAXP but tailored to work in J2ME environments (no access to system properties or file system) so name of parser class factory to use and its class used for loading (no classloader - on J2ME no access to context class loaders) must be passed explicitly. If no name of parser factory was passed (or is null) it will try to find name by searching in CLASSPATH for META-INF/services/org.xmlpull.v1.XmlPullParserFactory resource that should contain a comma separated list of class names of factories or parsers to try (in order from left to the right). If none found, it will throw an exception.
NOTE:In J2SE or J2EE environments, you may want to use
newInstance(property, classLoaderCtx)
where first argument is
System.getProperty(XmlPullParserFactory.PROPERTY_NAME)
and second is Thread.getContextClassLoader().getClass()
.
XmlPullParser
Field Summary | |
protected java.lang.String |
classNamesLocation
|
protected java.util.Hashtable |
features
|
protected java.util.Vector |
parserClasses
|
static java.lang.String |
PROPERTY_NAME
Name of the system or midlet property that should be used for a system property containing a comma separated list of factory or parser class names (value: org.xmlpull.v1.XmlPullParserFactory). |
protected java.util.Vector |
serializerClasses
|
Constructor Summary | |
protected |
XmlPullParserFactory()
Protected constructor to be called by factory implementations. |
Method Summary | |
boolean |
getFeature(java.lang.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()
Create a new instance of a PullParserFactory that can be used to create XML pull parsers (see class description for more details). |
static XmlPullParserFactory |
newInstance(java.lang.String classNames,
java.lang.Class context)
|
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(java.lang.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). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String PROPERTY_NAME
protected java.util.Vector parserClasses
protected java.lang.String classNamesLocation
protected java.util.Vector serializerClasses
protected java.util.Hashtable features
Constructor Detail |
protected XmlPullParserFactory()
Method Detail |
public void setFeature(java.lang.String name, boolean state) throws XmlPullParserException
NOTE: factory features are not used for XML Serializer.
name
- string with URI identifying featurestate
- if true feature will be set; if false will be ignored
XmlPullParserException
public boolean getFeature(java.lang.String name)
NOTE: factory features are not used for XML Serializer.
name
- The name of feature to be retrieved.
public void setNamespaceAware(boolean awareness)
awareness
- true if the parser produced by this code
will provide support for XML namespaces; false otherwise.public boolean isNamespaceAware()
public void setValidating(boolean validating)
validating
- - if true the parsers created by this factory must be validating.public boolean isValidating()
public XmlPullParser newPullParser() throws XmlPullParserException
XmlPullParserException
- if a parser cannot be created which satisfies the
requested configuration.public XmlSerializer newSerializer() throws XmlPullParserException
NOTE: factory features are not used for XML Serializer.
XmlPullParserException
- if a parser cannot be created which satisfies the
requested configuration.public static XmlPullParserFactory newInstance() throws XmlPullParserException
XmlPullParserException
public static XmlPullParserFactory newInstance(java.lang.String classNames, java.lang.Class context) throws XmlPullParserException
XmlPullParserException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |