Package org.gjt.xpp
Class XmlPullParserFactory
- java.lang.Object
-
- org.gjt.xpp.XmlPullParserFactory
-
- Direct Known Subclasses:
PullParserFactoryFullImpl
,PullParserFactorySmallImpl
,X2PullParserFactoryImpl
public class XmlPullParserFactory extends java.lang.Object
This class is used to create implementations of XML Pull Parser. Based on JAXP ideas but tailored to work in J2ME environments (no access to system properties or file system).- Author:
- Aleksander Slominski
- See Also:
XmlPullParser
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_PROPERTY_NAME
-
Constructor Summary
Constructors Modifier Constructor Description protected
XmlPullParserFactory()
Proteted constructor to be called by factory implementations.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isNamespaceAware()
Indicates whether or not the factory is configured to produce parsers which are namespace aware.XmlEndTag
newEndTag()
Create new end tag.XmlFormatter
newFormatter()
Return new XML formatter.static XmlPullParserFactory
newInstance()
Get a new instance of a PullParserFactory used to create XPP.static XmlPullParserFactory
newInstance(java.lang.Class classLoaderCtx)
Get a new instance of a PullParserFactory used to create XPP.static XmlPullParserFactory
newInstance(java.lang.String factoryClassName)
Get a new instance of a PullParserFactory from given class name.XmlNode
newNode()
Return new XML node.XmlNode
newNode(XmlPullParser pp)
Return new XML node that is represeting tree from current pull parser start tag.XmlPullNode
newPullNode(XmlPullParser pp)
Return new XML pull node that is represeting tree from current pull parser start tag.XmlPullParser
newPullParser()
Create new XML pull parser.XmlRecorder
newRecorder()
Return new XML recorder.XmlStartTag
newStartTag()
Return new XML start tag.XmlNode
readNode(java.io.Reader reader)
Equivalent to calling readNode(reader, false);XmlNode
readNode(java.io.Reader reader, boolean closeAtEnd)
Read XmlNode from input - essentially it is utility function that will create instance of pull parser, feed input inpt it and return new node tree parsed form the input.void
setNamespaceAware(boolean awareness)
Specifies that the parser produced by this factory will provide support for XML namespaces.void
writeNode(XmlNode node, java.io.Writer writer)
Equivalent to calling writeNode(node, writer, false);void
writeNode(XmlNode node, java.io.Writer writer, boolean closeAtEnd)
-
-
-
Field Detail
-
DEFAULT_PROPERTY_NAME
public static final java.lang.String DEFAULT_PROPERTY_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
newInstance
public static XmlPullParserFactory newInstance() throws XmlPullParserException
Get a new instance of a PullParserFactory used to create XPP.- Throws:
XmlPullParserException
-
newInstance
public static XmlPullParserFactory newInstance(java.lang.String factoryClassName) throws XmlPullParserException
Get a new instance of a PullParserFactory from given class name.- Parameters:
factoryClassName
- use specified factory class if not null- Throws:
XmlPullParserException
-
newInstance
public static XmlPullParserFactory newInstance(java.lang.Class classLoaderCtx) throws XmlPullParserException
Get a new instance of a PullParserFactory used to create XPP.NOTE: passing classLoaderCtx is not very useful in ME but can be useful in container environment where multiple class loaders are used (it is using Class as ClassLoader is not in ME profile).
- Parameters:
classLoaderCtx
- if not null it is used to find default factory and to create instance- Throws:
XmlPullParserException
-
setNamespaceAware
public void setNamespaceAware(boolean awareness) throws XmlPullParserException
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.- Throws:
XmlPullParserException
-
isNamespaceAware
public boolean isNamespaceAware()
Indicates whether or not the factory is configured to produce parsers which are namespace aware.- Returns:
- true if the factory is configured to produce parsers which are namespace aware; false otherwise.
-
newPullParser
public XmlPullParser newPullParser() throws XmlPullParserException
Create new XML pull parser.- Throws:
XmlPullParserException
-
newEndTag
public XmlEndTag newEndTag() throws XmlPullParserException
Create new end tag.- Throws:
XmlPullParserException
-
newNode
public XmlNode newNode() throws XmlPullParserException
Return new XML node.- Throws:
XmlPullParserException
-
newNode
public XmlNode newNode(XmlPullParser pp) throws XmlPullParserException, java.io.IOException
Return new XML node that is represeting tree from current pull parser start tag.- Throws:
XmlPullParserException
java.io.IOException
-
newPullNode
public XmlPullNode newPullNode(XmlPullParser pp) throws XmlPullParserException
Return new XML pull node that is represeting tree from current pull parser start tag.- Throws:
XmlPullParserException
-
newStartTag
public XmlStartTag newStartTag() throws XmlPullParserException
Return new XML start tag.- Throws:
XmlPullParserException
-
newFormatter
public XmlFormatter newFormatter() throws XmlPullParserException
Return new XML formatter.- Throws:
XmlPullParserException
-
newRecorder
public XmlRecorder newRecorder() throws XmlPullParserException
Return new XML recorder.- Throws:
XmlPullParserException
-
readNode
public XmlNode readNode(java.io.Reader reader, boolean closeAtEnd) throws XmlPullParserException, java.io.IOException
Read XmlNode from input - essentially it is utility function that will create instance of pull parser, feed input inpt it and return new node tree parsed form the input. If closeAtEnd is true clos() will be called on reader- Throws:
XmlPullParserException
java.io.IOException
-
readNode
public XmlNode readNode(java.io.Reader reader) throws XmlPullParserException, java.io.IOException
Equivalent to calling readNode(reader, false);- Throws:
XmlPullParserException
java.io.IOException
-
writeNode
public void writeNode(XmlNode node, java.io.Writer writer, boolean closeAtEnd) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
writeNode
public void writeNode(XmlNode node, java.io.Writer writer) throws XmlPullParserException, java.io.IOException
Equivalent to calling writeNode(node, writer, false);- Throws:
XmlPullParserException
java.io.IOException
-
-