org.gjt.xpp

Interface XmlPullParser

public interface XmlPullParser

Generic interface for simple and quick XML Pull Parser.

Author: Aleksander Slominski

See Also: XmlPullParserFactory

Field Summary
static byteCONTENT
element content was just read
static byteEND_DOCUMENT
signal logical end of xml document
static byteEND_TAG
end tag was just read
static byteSTART_TAG
start tag was just read
Method Summary
intgetColumnNumber()
intgetContentLength()
Return how big is content.
intgetDepth()
Returns the current depth of the element.
bytegetEventType()
Returns the type of the current element (START_TAG, END_TAG, CONTENT, etc)
intgetLineNumber()
StringgetLocalName()
Returns the local name of the current element (current event must be START_TAG or END_TAG)
intgetNamespacesLength(int depth)
StringgetNamespaceUri()
Returns the namespace URI of the current element Returns null if not applicable (current event must be START_TAG or END_TAG)
StringgetPosDesc()
StringgetPrefix()
Returns the prefix of the current element or null if elemet has no prefix. (current event must be START_TAG or END_TAG)
StringgetQNameLocal(String qName)
Return local part of qname.
StringgetQNameUri(String qName)
Return uri part of qname.
StringgetRawName()
Returns the raw name (prefix + ':' + localName) of the current element (current event must be START_TAG or END_TAG)
booleanisAllowedMixedContent()
Is mixed element context allowed?
booleanisNamespaceAttributesReporting()
Is parser going to report namespace attributes (xmlns*) ?
booleanisNamespaceAware()
Is parser namespace aware?
booleanisWhitespaceContent()
Check if last CONTENT contained only whitespace characters.
bytenext()
Get next parsing event.
StringreadContent()
Read current content as Stirng.
voidreadEndTag(XmlEndTag etag)
Read current end tag.
voidreadNamespacesPrefixes(int depth, String[] prefixes, int off, int len)
Return namespace prefixes for element at depth
voidreadNamespacesUris(int depth, String[] uris, int off, int len)
Return namespace URIs for element at depth
bytereadNode(XmlNode node)
Read subtree into node: call readNodeWithoutChildren and then parse subtree adding children (values obtained with readXontent or readNodeWithoutChildren).
voidreadNodeWithoutChildren(XmlNode node)
Read node: it calls readStartTag and then if parser is namespaces aware currently declared nemaspeces will be added and defaultNamespace will be set.
voidreadStartTag(XmlStartTag stag)
Read current start tag.
voidreset()
Reset the parser state.
voidsetAllowedMixedContent(boolean enable)
Allow for mixed element content.
voidsetInput(Reader in)
Set the input for parser.
voidsetInput(char[] buf)
Set the input for parser.
voidsetInput(char[] buf, int off, int len)
Set the input for parser.
voidsetNamespaceAttributesReporting(boolean enable)
Make parser to report xmlns* attributes.
voidsetNamespaceAware(boolean enable)
Indicate that the parser understands XML Namespaces

NOTE: this is not resetable parameter.

byteskipNode()
Goes directly to the next sibling

NOTE: parser must be on START_TAG event. and all intermittent events will be lost!

Field Detail

CONTENT

public static final byte CONTENT
element content was just read

END_DOCUMENT

public static final byte END_DOCUMENT
signal logical end of xml document

END_TAG

public static final byte END_TAG
end tag was just read

START_TAG

public static final byte START_TAG
start tag was just read

Method Detail

getColumnNumber

public int getColumnNumber()

getContentLength

public int getContentLength()
Return how big is content.

NOTE: parser must be on CONTENT event.

getDepth

public int getDepth()
Returns the current depth of the element.

getEventType

public byte getEventType()
Returns the type of the current element (START_TAG, END_TAG, CONTENT, etc)

getLineNumber

public int getLineNumber()

getLocalName

public String getLocalName()
Returns the local name of the current element (current event must be START_TAG or END_TAG)

getNamespacesLength

public int getNamespacesLength(int depth)

getNamespaceUri

public String getNamespaceUri()
Returns the namespace URI of the current element Returns null if not applicable (current event must be START_TAG or END_TAG)

getPosDesc

public String getPosDesc()

getPrefix

public String getPrefix()
Returns the prefix of the current element or null if elemet has no prefix. (current event must be START_TAG or END_TAG)

getQNameLocal

public String getQNameLocal(String qName)
Return local part of qname. For example for 'xsi:type' it returns 'type'.

getQNameUri

public String getQNameUri(String qName)
Return uri part of qname. It is depending on current state of parser to find what namespace uri is mapped from namespace prefix. For example for 'xsi:type' if xsi namespace prefix was declared to 'urn:foo' it will return 'urn:foo'.

getRawName

public String getRawName()
Returns the raw name (prefix + ':' + localName) of the current element (current event must be START_TAG or END_TAG)

isAllowedMixedContent

public boolean isAllowedMixedContent()
Is mixed element context allowed?

isNamespaceAttributesReporting

public boolean isNamespaceAttributesReporting()
Is parser going to report namespace attributes (xmlns*) ?

isNamespaceAware

public boolean isNamespaceAware()
Is parser namespace aware?

isWhitespaceContent

public boolean isWhitespaceContent()
Check if last CONTENT contained only whitespace characters.

next

public byte next()
Get next parsing event.

NOTE: empty element (such as <tag/>) will be reported with just two events: START_TAG, END_TAG - it must be so to preserve parsing equivalency of empty element to <tag></tag>.

readContent

public String readContent()
Read current content as Stirng.

NOTE: parser must be on CONTENT event.

readEndTag

public void readEndTag(XmlEndTag etag)
Read current end tag.

NOTE: parser must be on END_TAG event.

readNamespacesPrefixes

public void readNamespacesPrefixes(int depth, String[] prefixes, int off, int len)
Return namespace prefixes for element at depth

readNamespacesUris

public void readNamespacesUris(int depth, String[] uris, int off, int len)
Return namespace URIs for element at depth

readNode

public byte readNode(XmlNode node)
Read subtree into node: call readNodeWithoutChildren and then parse subtree adding children (values obtained with readXontent or readNodeWithoutChildren).

NOTE: parser must be on START_TAG event. and all events will written into node!

readNodeWithoutChildren

public void readNodeWithoutChildren(XmlNode node)
Read node: it calls readStartTag and then if parser is namespaces aware currently declared nemaspeces will be added and defaultNamespace will be set.

NOTE: parser must be on START_TAG event. and all events will written into node!

readStartTag

public void readStartTag(XmlStartTag stag)
Read current start tag.

NOTE: parser must be on START_TAG event.

reset

public void reset()
Reset the parser state.

setAllowedMixedContent

public void setAllowedMixedContent(boolean enable)
Allow for mixed element content. Disabled by default. When disbaled element must containt either text or other elements.

NOTE: this is not resetable parameter.

setInput

public void setInput(Reader in)
Set the input for parser.

setInput

public void setInput(char[] buf)
Set the input for parser.

setInput

public void setInput(char[] buf, int off, int len)
Set the input for parser.

setNamespaceAttributesReporting

public void setNamespaceAttributesReporting(boolean enable)
Make parser to report xmlns* attributes. Disabled by default. Only meaningful when namespaces are enabled (when namespaces are disabled all attributes are always reported).

setNamespaceAware

public void setNamespaceAware(boolean enable)
Indicate that the parser understands XML Namespaces

NOTE: this is not resetable parameter.

skipNode

public byte skipNode()
Goes directly to the next sibling

NOTE: parser must be on START_TAG event. and all intermittent events will be lost!

Copyright (c) 2003 IU Extreme! Lab http://www.extreme.indiana.edu/ All Rights Reserved.

Note this package is deprecated by XPP3 that implements XmlPull API