org.gjt.xpp

Interface XmlNode

All Superinterfaces:
XmlStartTag, XmlTag
Known Subinterfaces:
XmlPullNode
Known Implementing Classes:
Node, PullNode

public interface XmlNode
extends XmlStartTag

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:

Author:
Aleksander Slominski
See Also:
XmlStartTag

Method Summary

void
addDeclaredNamespaces(String[] prefix, int off, int len, String[] namespaceUri)
NOTE: node SHOULD NOT keep references to passed arrays!
void
addNamespaceDeclaration(String prefix, String namespaceUri)
void
appendChild(Object child)
Enumeration
children()
void
ensureChildrenCapacity(int minCapacity)
void
ensureDeclaredNamespacesCapacity(int minCapacity)
Object
getChildAt(int pos)
int
getChildrenCount()
it may need to reconsruct whole subtree to get count ...
int
getDeclaredNamespaceLength()
String
getDefaultNamespaceUri()
Namesapce URI associated with default namesapce prefix (xmlns='....')
XmlNode
getParentNode()
String
getQNameLocal(String qName)
Return local part of qname.
String
getQNameUri(String qName)
Return uri part of qname.
void
insertChildAt(int pos, Object child)
String
namespace2Prefix(String namespaceUri)
return prefix for namesapce searching node tree upward.
XmlNode
newNode()
context sensitive factory method to create the same type of node
XmlNode
newNode(String amespaceUri, String localName)
String
prefix2Namespace(String prefix)
return namespace for prefix searching node tree upward.
void
readDeclaredNamespaceUris(String[] uris, int off, int len)
void
readDeclaredPrefixes(String[] prefixes, int off, int len)
void
removeChildAt(int pos)
void
removeChildren()
Removes all children - every child that was implementing XmlNode will have set parent to null.
void
removeDeclaredNamespaces()
void
replaceChildAt(int pos, Object child)
void
resetNode()
Clear all Tag state to default values.
void
setDefaultNamespaceUri(String defaultNamespaceUri)
Set default namesapce URI (xmlns='....')
void
setParentNode(XmlNode parent)

Methods inherited from interface org.gjt.xpp.XmlStartTag

addAttribute, addAttribute, ensureAttributesCapacity, getAttributeCount, getAttributeLocalName, getAttributeNamespaceUri, getAttributePrefix, getAttributeRawName, getAttributeValue, getAttributeValueFromName, getAttributeValueFromRawName, isAttributeNamespaceDeclaration, removeAttributeByName, removeAttributeByRawName, removeAttributes, resetStartTag

Methods inherited from interface org.gjt.xpp.XmlTag

getLocalName, getNamespaceUri, getPrefix, getRawName, modifyTag, resetTag

Method Details

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

appendChild

public void appendChild(Object child)
            throws XmlPullParserException

children

public Enumeration children()

ensureChildrenCapacity

public void ensureChildrenCapacity(int minCapacity)
            throws XmlPullParserException

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'.

insertChildAt

public void insertChildAt(int pos,
                          Object child)
            throws XmlPullParserException

namespace2Prefix

public String namespace2Prefix(String namespaceUri)
            throws XmlPullParserException
return prefix for namesapce searching node tree upward.

newNode

public XmlNode newNode()
            throws XmlPullParserException
context sensitive factory method to create the same type of node

newNode

public XmlNode newNode(String amespaceUri,
                       String localName)
            throws XmlPullParserException

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

removeChildAt

public void removeChildAt(int pos)
            throws XmlPullParserException

removeChildren

public void removeChildren()
            throws XmlPullParserException
Removes all children - every child that was implementing XmlNode will have set parent to null.

removeDeclaredNamespaces

public void removeDeclaredNamespaces()
            throws XmlPullParserException

replaceChildAt

public void replaceChildAt(int pos,
                           Object child)
            throws XmlPullParserException

resetNode

public void resetNode()
Clear all Tag state to default values.

setDefaultNamespaceUri

public void setDefaultNamespaceUri(String defaultNamespaceUri)
            throws XmlPullParserException
Set default namesapce URI (xmlns='....')

setParentNode

public void setParentNode(XmlNode parent)
            throws XmlPullParserException

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