|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gjt.xpp.impl.tag.Tag
org.gjt.xpp.impl.tag.StartTag
org.gjt.xpp.impl.node.Node
org.gjt.xpp.impl.pullnode.PullNode
public class PullNode
Allows node tree to be constructed on demand. When PullNode is constructed and method setPullPasrser() is executed (or constructor with PullParser arg is called) node is assumend to be incomplete and children will be retrieved on demand (pulled) including automatic creation of sub pull nodes. If no pull parser is associated (it is null) this class must work like regular XmlNode...
| Field Summary | |
|---|---|
protected int |
depth
|
protected XmlPullParser |
pp
|
| Fields inherited from class org.gjt.xpp.impl.node.Node |
|---|
children, childrenCount, declaredNs, declaredNsEnd, declaredPrefixes, defaultNamespaceUri, EMPTY_ENUMERATION, oneChild, parent, prefix2Ns |
| Constructor Summary | |
|---|---|
PullNode(XmlPullParser pp)
|
|
| Method Summary | |
|---|---|
void |
appendChild(java.lang.Object child)
|
java.util.Enumeration |
children()
This is not recommened method to pull children when node is not finished (use readNextChild() instead) as Enumeration interface does not allow to throw XmlPullParserException so any parsing exeption is wrapped into RuntimeException making code more messy... |
java.lang.Object |
getChildAt(int pos)
|
int |
getChildrenCount()
it will reconsruct whole subtree to get count ... |
int |
getChildrenCountSoFar()
if unfinished it returns actual number of children... |
XmlPullParser |
getPullParser()
Get parser that is use to build this node tree and this pull node becomes finished - the caller is responsibile to move pull parser state to the end tag of this node (or parent pull node will be left in unconsistent state!!!!). |
void |
insertChildAt(int pos,
java.lang.Object child)
|
boolean |
isFinished()
Is pull parsing of node finished. |
XmlNode |
newNode()
context sensitive factory method to create the same type of node |
XmlPullNode |
newPullNode(XmlPullParser pp)
|
protected void |
printFields(java.lang.StringBuffer buf)
Print this class state into StringBuffer element name |
void |
readChildren()
Read all reminaing children up to end tag. |
java.lang.Object |
readNextChild()
This is preferred method to pull children (children() requires .wrapping object Enumeration). |
void |
removeChildAt(int pos)
|
void |
removeChildren()
Removes all children - every child that was implementing XmlNode will have set parent to null. |
void |
replaceChildAt(int pos,
java.lang.Object child)
|
void |
resetPullNode()
PullNode stays in finished state. |
void |
setPullParser(XmlPullParser pp)
Reset pull node to use pull parser. |
void |
skipChildren()
|
java.lang.String |
toString()
Return string representation of start tag including name and list of attributes. |
| Methods inherited from class org.gjt.xpp.impl.node.Node |
|---|
addDeclaredNamespaces, addNamespaceDeclaration, ensureChildrenCapacity, ensureDeclaredNamespacesCapacity, equals, getDeclaredNamespaceLength, getDefaultNamespaceUri, getParentNode, getQNameLocal, getQNameUri, namespace2Prefix, newNode, prefix2Namespace, readDeclaredNamespaceUris, readDeclaredPrefixes, removeDeclaredNamespaces, resetNode, setDefaultNamespaceUri, setParentNode |
| Methods inherited from class org.gjt.xpp.impl.tag.Tag |
|---|
getLocalName, getNamespaceUri, getPrefix, getRawName, hashCode, modifyTag, resetTag |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.gjt.xpp.XmlTag |
|---|
getLocalName, getNamespaceUri, getPrefix, getRawName, modifyTag, resetTag |
| Field Detail |
|---|
protected int depth
protected XmlPullParser pp
| Constructor Detail |
|---|
public PullNode(XmlPullParser pp)
throws XmlPullParserException
XmlPullParserException| Method Detail |
|---|
public XmlNode newNode()
throws XmlPullParserException
Node
newNode in interface XmlNodenewNode in interface XmlPullNodenewNode in class NodeXmlPullParserException
public XmlPullNode newPullNode(XmlPullParser pp)
throws XmlPullParserException
newPullNode in interface XmlPullNodeXmlPullParserExceptionpublic void resetPullNode()
resetPullNode in interface XmlPullNodepublic boolean isFinished()
XmlPullNode
isFinished in interface XmlPullNode
public XmlPullParser getPullParser()
throws java.io.IOException,
XmlPullParserException
XmlPullNodeNOTE: this pull node must be in unfinished state or exception will be thrown
getPullParser in interface XmlPullNodejava.io.IOException
XmlPullParserException
public void setPullParser(XmlPullParser pp)
throws XmlPullParserException
setPullParser in interface XmlPullNodeXmlPullParserExceptionpublic java.util.Enumeration children()
XmlPullNode
children in interface XmlNodechildren in interface XmlPullNodechildren in class NodeXmlPullNode.readNextChild()
public java.lang.Object readNextChild()
throws XmlPullParserException,
java.io.IOException
XmlPullNode
readNextChild in interface XmlPullNodeXmlPullParserException
java.io.IOExceptionXmlPullNode.children()
public void readChildren()
throws XmlPullParserException,
java.io.IOException
readChildren in interface XmlPullNodeXmlPullParserException
java.io.IOException
public void skipChildren()
throws XmlPullParserException,
java.io.IOException
skipChildren in interface XmlPullNodeXmlPullParserException
java.io.IOExceptionpublic int getChildrenCountSoFar()
getChildrenCountSoFar in interface XmlPullNodepublic int getChildrenCount()
getChildrenCount in interface XmlNodegetChildrenCount in class Nodepublic java.lang.Object getChildAt(int pos)
getChildAt in interface XmlNodegetChildAt in class Node
public void appendChild(java.lang.Object child)
throws XmlPullParserException
appendChild in interface XmlNodeappendChild in class NodeXmlPullParserException
public void insertChildAt(int pos,
java.lang.Object child)
throws XmlPullParserException
insertChildAt in interface XmlNodeinsertChildAt in class NodeXmlPullParserException
public void removeChildAt(int pos)
throws XmlPullParserException
removeChildAt in interface XmlNoderemoveChildAt in class NodeXmlPullParserException
public void replaceChildAt(int pos,
java.lang.Object child)
throws XmlPullParserException
replaceChildAt in interface XmlNodereplaceChildAt in class NodeXmlPullParserException
public void removeChildren()
throws XmlPullParserException
XmlNode
removeChildren in interface XmlNoderemoveChildren in class NodeXmlPullParserExceptionprotected void printFields(java.lang.StringBuffer buf)
printFields in class Nodepublic java.lang.String toString()
toString in class Node
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||