|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.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 the name of parser facotry class. If none found it will try to create a default parser factory (if available) or throw exception.
NOTE:In J2SE or J2EE environments to get best results use
newInstance(property, classLoaderCtx)
where first argument is
System.getProperty(XmlPullParserFactory.DEFAULT_PROPERTY_NAME)
and second is Thread.getContextClassLoader().getClas()
.
XmlPullParser
Field Summary | |
static java.lang.String |
DEFAULT_PROPERTY_NAME
name of parser factory property that should be used for system property or in general to retrieve parser factory clas sname from configuration (currently name of peroperty is org.xmlpull.v1.XmlPullParserFactory) |
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. |
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 used to create XML pull parser (see description of class for more details). |
static XmlPullParserFactory |
newInstance(java.lang.Class classLoaderCtx)
Get a new instance of a PullParserFactory used to create XML Pull Parser. |
static XmlPullParserFactory |
newInstance(java.lang.Class classLoaderCtx,
java.lang.String factoryClassName)
Get instance of XML pull parser factiry. |
static XmlPullParserFactory |
newInstance(java.lang.String factoryClassName)
Get a new instance of a PullParserFactory from given class name. |
abstract XmlPullParser |
newPullParser()
Creates a new instance of a XML Pull Parser using the currently configured factory parameters. |
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 By default the value of this is set to false. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String DEFAULT_PROPERTY_NAME
Method Detail |
public static XmlPullParserFactory newInstance() throws XmlPullParserException
public static XmlPullParserFactory newInstance(java.lang.String factoryClassName) throws XmlPullParserException
factoryClassName
- use specified factory class if not nullpublic static XmlPullParserFactory newInstance(java.lang.Class classLoaderCtx) throws XmlPullParserException
NOTE: passing classLoaderCtx is not very useful in ME but can be useful in J2SE, J2EE or in container environments (such as servlets) where multiple class loaders are used (it is using Class as ClassLoader is not in ME profile).
classLoaderCtx
- if not null it is used to find
default factory and to create instancepublic static XmlPullParserFactory newInstance(java.lang.Class classLoaderCtx, java.lang.String factoryClassName) throws XmlPullParserException
NOTE: this allows to use -D system properties indirectly and still to support flexible configuration in J2ME environments..
classLoaderCtx
- if null Class.forName will be used instead
- simple way to use class loaders and still have ME compatibility!hint
- with name of parser factory to use -
it is a hint and is ignored if factory is not available.public void setFeature(java.lang.String name, boolean state) throws XmlPullParserException
name
- string with URI identifying featurestate
- if true feature will be set; if false will be ignoredpublic boolean getFeature(java.lang.String name)
name
- The name of feature to be retrieved.public void setNamespaceAware(boolean awareness) throws XmlPullParserException
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) throws XmlPullParserException
validating
- - if true the parsers created by this factory must be validating.public boolean isValidating()
public abstract XmlPullParser newPullParser() throws XmlPullParserException
XmlPullParserException
- if a parser cannot be created which satisfies the
requested configuration.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |