Package org.gjt.xpp.impl.node
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 TypeMethodDescriptionvoid
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) children()
void
ensureChildrenCapacity
(int minCapacity) void
ensureDeclaredNamespacesCapacity
(int minCapacity) boolean
getChildAt
(int pos) int
it may need to reconsruct whole subtree to get count ...int
Namesapce URI associated with default namesapce prefix (xmlns='....')getQNameLocal
(String qName) Return local part of qname.getQNameUri
(String qName) Return uri part of qname.void
insertChildAt
(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 void
printFields
(StringBuffer buf) Print into StringBuffer element namevoid
readDeclaredNamespaceUris
(String[] uris, int off, int len) void
readDeclaredPrefixes
(String[] prefixes, int off, int len) void
removeChildAt
(int pos) void
Removes all children - every child that was implementing XmlNode will have set parent to null.void
void
replaceChildAt
(int pos, Object child) void
Clear all Tag state to default values.void
setDefaultNamespaceUri
(String defaultNamespaceUri) Set default namesapce URI (xmlns='....')void
setParentNode
(XmlNode parent) toString()
Return string representation of start tag including name and list of attributes.Methods inherited from class org.gjt.xpp.impl.tag.StartTag
addAttribute, addAttribute, ensureAttributesCapacity, getAttributeCount, getAttributeLocalName, getAttributeNamespaceUri, getAttributePrefix, getAttributeRawName, getAttributeValue, getAttributeValueFromName, getAttributeValueFromRawName, isAttributeNamespaceDeclaration, removeAttributeByName, removeAttributeByRawName, removeAttributes, resetStartTag
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.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
-
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
public void resetNode()Description copied from interface:XmlNode
Clear all Tag state to default values. -
newNode
context sensitive factory method to create the same type of node- Specified by:
newNode
in interfaceXmlNode
- Throws:
XmlPullParserException
-
newNode
- Specified by:
newNode
in interfaceXmlNode
- Throws:
XmlPullParserException
-
getParentNode
- Specified by:
getParentNode
in interfaceXmlNode
-
children
-
getChildrenCount
public int getChildrenCount()it may need to reconsruct whole subtree to get count ...- Specified by:
getChildrenCount
in interfaceXmlNode
-
getChildAt
- Specified by:
getChildAt
in interfaceXmlNode
-
setParentNode
- Specified by:
setParentNode
in interfaceXmlNode
-
appendChild
- Specified by:
appendChild
in interfaceXmlNode
- Throws:
XmlPullParserException
-
insertChildAt
- Specified by:
insertChildAt
in interfaceXmlNode
- Throws:
XmlPullParserException
-
removeChildAt
- Specified by:
removeChildAt
in interfaceXmlNode
- Throws:
XmlPullParserException
-
replaceChildAt
- Specified by:
replaceChildAt
in interfaceXmlNode
- Throws:
XmlPullParserException
-
ensureChildrenCapacity
- Specified by:
ensureChildrenCapacity
in interfaceXmlNode
- Throws:
XmlPullParserException
-
removeChildren
Description copied from interface:XmlNode
Removes all children - every child that was implementing XmlNode will have set parent to null.- Specified by:
removeChildren
in interfaceXmlNode
- Throws:
XmlPullParserException
-
getQNameLocal
Description copied from interface:XmlNode
Return local part of qname. For example for 'xsi:type' it returns 'type'.- Specified by:
getQNameLocal
in interfaceXmlNode
-
getQNameUri
Description copied from interface:XmlNode
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'.- Specified by:
getQNameUri
in interfaceXmlNode
-
prefix2Namespace
Description copied from interface:XmlNode
return namespace for prefix searching node tree upward.- Specified by:
prefix2Namespace
in interfaceXmlNode
- Throws:
XmlPullParserException
-
namespace2Prefix
Description copied from interface:XmlNode
return prefix for namesapce searching node tree upward.- Specified by:
namespace2Prefix
in interfaceXmlNode
- Throws:
XmlPullParserException
-
getDefaultNamespaceUri
Description copied from interface:XmlNode
Namesapce URI associated with default namesapce prefix (xmlns='....')- Specified by:
getDefaultNamespaceUri
in interfaceXmlNode
-
setDefaultNamespaceUri
Description copied from interface:XmlNode
Set default namesapce URI (xmlns='....')- Specified by:
setDefaultNamespaceUri
in interfaceXmlNode
-
getDeclaredNamespaceLength
public int getDeclaredNamespaceLength()- Specified by:
getDeclaredNamespaceLength
in interfaceXmlNode
-
readDeclaredNamespaceUris
- Specified by:
readDeclaredNamespaceUris
in interfaceXmlNode
-
readDeclaredPrefixes
- Specified by:
readDeclaredPrefixes
in interfaceXmlNode
-
ensureDeclaredNamespacesCapacity
public void ensureDeclaredNamespacesCapacity(int minCapacity) - Specified by:
ensureDeclaredNamespacesCapacity
in interfaceXmlNode
-
addNamespaceDeclaration
public void addNamespaceDeclaration(String prefix, String namespaceUri) throws XmlPullParserException - Specified by:
addNamespaceDeclaration
in interfaceXmlNode
- Throws:
XmlPullParserException
-
addDeclaredNamespaces
Description copied from interface:XmlNode
NOTE: node SHOULD NOT keep references to passed arrays!- Specified by:
addDeclaredNamespaces
in interfaceXmlNode
-
removeDeclaredNamespaces
public void removeDeclaredNamespaces()- Specified by:
removeDeclaredNamespaces
in interfaceXmlNode
-
printFields
Print into StringBuffer element name- Overrides:
printFields
in classStartTag
-
toString
Return string representation of start tag including name and list of attributes.
-