org.gjt.xpp
Interface XmlNode

All Superinterfaces:
XmlStartTag, XmlTag
All Known Subinterfaces:
XmlPullNode

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(java.lang.String[] prefix, int off, int len, java.lang.String[] namespaceUri)
          NOTE: node SHOULD NOT keep references to passed arrays!
 void addNamespaceDeclaration(java.lang.String prefix, java.lang.String namespaceUri)
           
 void appendChild(java.lang.Object child)
           
 java.util.Enumeration children()
           
 void ensureChildrenCapacity(int minCapacity)
           
 void ensureDeclaredNamespacesCapacity(int minCapacity)
           
 java.lang.Object getChildAt(int pos)
           
 int getChildrenCount()
          it may need to reconsruct whole subtree to get count ...
 int getDeclaredNamespaceLength()
           
 java.lang.String getDefaultNamespaceUri()
          Namesapce URI associated with default namesapce prefix (xmlns='....')
 XmlNode getParentNode()
           
 java.lang.String getQNameLocal(java.lang.String qName)
          Return local part of qname.
 java.lang.String getQNameUri(java.lang.String qName)
          Return uri part of qname.
 void insertChildAt(int pos, java.lang.Object child)
           
 java.lang.String namespace2Prefix(java.lang.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(java.lang.String amespaceUri, java.lang.String localName)
           
 java.lang.String prefix2Namespace(java.lang.String prefix)
          return namespace for prefix searching node tree upward.
 void readDeclaredNamespaceUris(java.lang.String[] uris, int off, int len)
           
 void readDeclaredPrefixes(java.lang.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, java.lang.Object child)
           
 void resetNode()
          Clear all Tag state to default values.
 void setDefaultNamespaceUri(java.lang.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 Detail

resetNode

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


newNode

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

Throws:
XmlPullParserException

newNode

public XmlNode newNode(java.lang.String amespaceUri,
                       java.lang.String localName)
                throws XmlPullParserException
Throws:
XmlPullParserException

getParentNode

public XmlNode getParentNode()

setParentNode

public void setParentNode(XmlNode parent)
                   throws XmlPullParserException
Throws:
XmlPullParserException

children

public java.util.Enumeration children()

getChildrenCount

public int getChildrenCount()
it may need to reconsruct whole subtree to get count ...


getChildAt

public java.lang.Object getChildAt(int pos)

appendChild

public void appendChild(java.lang.Object child)
                 throws XmlPullParserException
Throws:
XmlPullParserException

insertChildAt

public void insertChildAt(int pos,
                          java.lang.Object child)
                   throws XmlPullParserException
Throws:
XmlPullParserException

removeChildAt

public void removeChildAt(int pos)
                   throws XmlPullParserException
Throws:
XmlPullParserException

replaceChildAt

public void replaceChildAt(int pos,
                           java.lang.Object child)
                    throws XmlPullParserException
Throws:
XmlPullParserException

ensureChildrenCapacity

public void ensureChildrenCapacity(int minCapacity)
                            throws XmlPullParserException
Throws:
XmlPullParserException

removeChildren

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

Throws:
XmlPullParserException

getQNameLocal

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

Throws:
XmlPullParserException

getQNameUri

public java.lang.String getQNameUri(java.lang.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'.

Throws:
XmlPullParserException

prefix2Namespace

public java.lang.String prefix2Namespace(java.lang.String prefix)
                                  throws XmlPullParserException
return namespace for prefix searching node tree upward.

Throws:
XmlPullParserException

namespace2Prefix

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

Throws:
XmlPullParserException

getDefaultNamespaceUri

public java.lang.String getDefaultNamespaceUri()
Namesapce URI associated with default namesapce prefix (xmlns='....')


setDefaultNamespaceUri

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

Throws:
XmlPullParserException

getDeclaredNamespaceLength

public int getDeclaredNamespaceLength()

readDeclaredNamespaceUris

public void readDeclaredNamespaceUris(java.lang.String[] uris,
                                      int off,
                                      int len)
                               throws XmlPullParserException
Throws:
XmlPullParserException

readDeclaredPrefixes

public void readDeclaredPrefixes(java.lang.String[] prefixes,
                                 int off,
                                 int len)
                          throws XmlPullParserException
Throws:
XmlPullParserException

ensureDeclaredNamespacesCapacity

public void ensureDeclaredNamespacesCapacity(int minCapacity)
                                      throws XmlPullParserException
Throws:
XmlPullParserException

addNamespaceDeclaration

public void addNamespaceDeclaration(java.lang.String prefix,
                                    java.lang.String namespaceUri)
                             throws XmlPullParserException
Throws:
XmlPullParserException

addDeclaredNamespaces

public void addDeclaredNamespaces(java.lang.String[] prefix,
                                  int off,
                                  int len,
                                  java.lang.String[] namespaceUri)
                           throws XmlPullParserException
NOTE: node SHOULD NOT keep references to passed arrays!

Throws:
XmlPullParserException

removeDeclaredNamespaces

public void removeDeclaredNamespaces()
                              throws XmlPullParserException
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