Class Node
java.lang.Object
org.gjt.xpp.impl.tag.Tag
org.gjt.xpp.impl.tag.StartTag
org.gjt.xpp.impl.node.Node
- All Implemented Interfaces:
XmlNode, XmlStartTag, XmlTag
- Direct Known Subclasses:
PullNode
Encapsulate XML Node with list of associated children and namespaces :-).
- Author:
- Aleksander Slominski
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDeclaredNamespaces(String[] prefix, int off, int len, String[] namespaceUri) NOTE: node SHOULD NOT keep references to passed arrays!voidaddNamespaceDeclaration(String prefix, String namespaceUri) voidappendChild(Object child) children()voidensureChildrenCapacity(int minCapacity) voidensureDeclaredNamespacesCapacity(int minCapacity) booleangetChildAt(int pos) intit may need to reconsruct whole subtree to get count ...intNamesapce URI associated with default namesapce prefix (xmlns='....')getQNameLocal(String qName) Return local part of qname.getQNameUri(String qName) Return uri part of qname.voidinsertChildAt(int pos, Object child) namespace2Prefix(String namespaceUri) return prefix for namesapce searching node tree upward.newNode()context sensitive factory method to create the same type of nodeprefix2Namespace(String prefix) return namespace for prefix searching node tree upward.protected voidprintFields(StringBuffer buf) Print into StringBuffer element namevoidreadDeclaredNamespaceUris(String[] uris, int off, int len) voidreadDeclaredPrefixes(String[] prefixes, int off, int len) voidremoveChildAt(int pos) voidRemoves all children - every child that was implementing XmlNode will have set parent to null.voidvoidreplaceChildAt(int pos, Object child) voidClear all Tag state to default values.voidsetDefaultNamespaceUri(String defaultNamespaceUri) Set default namesapce URI (xmlns='....')voidsetParentNode(XmlNode parent) toString()Return string representation of start tag including name and list of attributes.Methods inherited from class StartTag
addAttribute, addAttribute, ensureAttributesCapacity, getAttributeCount, getAttributeLocalName, getAttributeNamespaceUri, getAttributePrefix, getAttributeRawName, getAttributeValue, getAttributeValueFromName, getAttributeValueFromRawName, isAttributeNamespaceDeclaration, removeAttributeByName, removeAttributeByRawName, removeAttributes, resetStartTagMethods inherited from class Tag
getLocalName, getNamespaceUri, getPrefix, getRawName, hashCode, modifyTag, resetTagMethods inherited from interface XmlStartTag
addAttribute, addAttribute, ensureAttributesCapacity, getAttributeCount, getAttributeLocalName, getAttributeNamespaceUri, getAttributePrefix, getAttributeRawName, getAttributeValue, getAttributeValueFromName, getAttributeValueFromRawName, isAttributeNamespaceDeclaration, removeAttributeByName, removeAttributeByRawName, removeAttributes, resetStartTagMethods inherited from interface XmlTag
getLocalName, getNamespaceUri, getPrefix, getRawName, modifyTag, resetTag
-
Field Details
-
EMPTY_ENUMERATION
-
children
-
childrenCount
protected int childrenCount -
oneChild
-
parent
-
defaultNamespaceUri
-
prefix2Ns
-
declaredNsEnd
protected int declaredNsEnd -
declaredNs
-
declaredPrefixes
-
-
Constructor Details
-
Node
public Node()
-
-
Method Details
-
equals
-
resetNode
-
newNode
context sensitive factory method to create the same type of node- Specified by:
newNodein interfaceXmlNode- Throws:
XmlPullParserException
-
newNode
- Specified by:
newNodein interfaceXmlNode- Throws:
XmlPullParserException
-
getParentNode
- Specified by:
getParentNodein interfaceXmlNode
-
children
-
getChildrenCount
public int getChildrenCount()it may need to reconsruct whole subtree to get count ...- Specified by:
getChildrenCountin interfaceXmlNode
-
getChildAt
- Specified by:
getChildAtin interfaceXmlNode
-
setParentNode
- Specified by:
setParentNodein interfaceXmlNode
-
appendChild
- Specified by:
appendChildin interfaceXmlNode- Throws:
XmlPullParserException
-
insertChildAt
- Specified by:
insertChildAtin interfaceXmlNode- Throws:
XmlPullParserException
-
removeChildAt
- Specified by:
removeChildAtin interfaceXmlNode- Throws:
XmlPullParserException
-
replaceChildAt
- Specified by:
replaceChildAtin interfaceXmlNode- Throws:
XmlPullParserException
-
ensureChildrenCapacity
- Specified by:
ensureChildrenCapacityin interfaceXmlNode- Throws:
XmlPullParserException
-
removeChildren
Description copied from interface:XmlNodeRemoves all children - every child that was implementing XmlNode will have set parent to null.- Specified by:
removeChildrenin interfaceXmlNode- Throws:
XmlPullParserException
-
getQNameLocal
Description copied from interface:XmlNodeReturn local part of qname. For example for 'xsi:type' it returns 'type'.- Specified by:
getQNameLocalin interfaceXmlNode
-
getQNameUri
Description copied from interface:XmlNodeReturn 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'.- Specified by:
getQNameUriin interfaceXmlNode
-
prefix2Namespace
Description copied from interface:XmlNodereturn namespace for prefix searching node tree upward.- Specified by:
prefix2Namespacein interfaceXmlNode- Throws:
XmlPullParserException
-
namespace2Prefix
Description copied from interface:XmlNodereturn prefix for namesapce searching node tree upward.- Specified by:
namespace2Prefixin interfaceXmlNode- Throws:
XmlPullParserException
-
getDefaultNamespaceUri
Description copied from interface:XmlNodeNamesapce URI associated with default namesapce prefix (xmlns='....')- Specified by:
getDefaultNamespaceUriin interfaceXmlNode
-
setDefaultNamespaceUri
Description copied from interface:XmlNodeSet default namesapce URI (xmlns='....')- Specified by:
setDefaultNamespaceUriin interfaceXmlNode
-
getDeclaredNamespaceLength
public int getDeclaredNamespaceLength()- Specified by:
getDeclaredNamespaceLengthin interfaceXmlNode
-
readDeclaredNamespaceUris
- Specified by:
readDeclaredNamespaceUrisin interfaceXmlNode
-
readDeclaredPrefixes
- Specified by:
readDeclaredPrefixesin interfaceXmlNode
-
ensureDeclaredNamespacesCapacity
public void ensureDeclaredNamespacesCapacity(int minCapacity) - Specified by:
ensureDeclaredNamespacesCapacityin interfaceXmlNode
-
addNamespaceDeclaration
public void addNamespaceDeclaration(String prefix, String namespaceUri) throws XmlPullParserException - Specified by:
addNamespaceDeclarationin interfaceXmlNode- Throws:
XmlPullParserException
-
addDeclaredNamespaces
Description copied from interface:XmlNodeNOTE: node SHOULD NOT keep references to passed arrays!- Specified by:
addDeclaredNamespacesin interfaceXmlNode
-
removeDeclaredNamespaces
public void removeDeclaredNamespaces()- Specified by:
removeDeclaredNamespacesin interfaceXmlNode
-
printFields
Print into StringBuffer element name- Overrides:
printFieldsin classStartTag
-
toString
-