This class represents XML subtree.
XmlNode is extension of XmlStartTag adding support for children
(some of them may be also XmlNode so we get recursively built tree)
and namespaces declarations associated with this node.
When node has no children and namespaces declared it is
essentially equivalent to XmlStartTag.
When XmlNode user does not need namespaces then namespace related
methods may be ignored. However to use namespaces it is required to:
- call setDefaultNamespaceUri() to associate default namespace
in which this node is declared
- and to declare additional namespaces (as of xmlns:prefix="...")
with calling first removeNamespaces() and then addNamespaces()
addDeclaredNamespaces
public void addDeclaredNamespaces(String[] prefix,
int off,
int len,
String[] namespaceUri)
throws XmlPullParserException
NOTE: node SHOULD NOT keep references to passed arrays!
addNamespaceDeclaration
public void addNamespaceDeclaration(String prefix,
String namespaceUri)
throws XmlPullParserException
children
public Enumeration children()
ensureDeclaredNamespacesCapacity
public void ensureDeclaredNamespacesCapacity(int minCapacity)
throws XmlPullParserException
getChildAt
public Object getChildAt(int pos)
getChildrenCount
public int getChildrenCount()
it may need to reconsruct whole subtree to get count ...
getDeclaredNamespaceLength
public int getDeclaredNamespaceLength()
getDefaultNamespaceUri
public String getDefaultNamespaceUri()
Namesapce URI associated with default namesapce prefix (xmlns='....')
getParentNode
public XmlNode getParentNode()
getQNameLocal
public String getQNameLocal(String qName)
throws XmlPullParserException
Return local part of qname.
For example for 'xsi:type' it returns 'type'.
getQNameUri
public String getQNameUri(String qName)
throws XmlPullParserException
Return uri part of qname.
The return value is dependent on declared namespaces in this
node and possible when looking for value in parent node.
For example for 'xsi:type' if xsi namespace prefix
was declared to 'http://foo' it will return 'http://foo'.
namespace2Prefix
public String namespace2Prefix(String namespaceUri)
throws XmlPullParserException
return prefix for namesapce searching node tree upward.
prefix2Namespace
public String prefix2Namespace(String prefix)
throws XmlPullParserException
return namespace for prefix searching node tree upward.
readDeclaredNamespaceUris
public void readDeclaredNamespaceUris(String[] uris,
int off,
int len)
throws XmlPullParserException
readDeclaredPrefixes
public void readDeclaredPrefixes(String[] prefixes,
int off,
int len)
throws XmlPullParserException
removeChildren
public void removeChildren()
throws XmlPullParserException
Removes all children - every child that was
implementing XmlNode will have set parent to null.
resetNode
public void resetNode()
Clear all Tag state to default values.
setDefaultNamespaceUri
public void setDefaultNamespaceUri(String defaultNamespaceUri)
throws XmlPullParserException
Set default namesapce URI (xmlns='....')