|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.planx.xmlstore.DocNode
public class DocNode
DocNode is an occurrence of a Node in a document.
DocNode provides the ability to locate the parent, root,
and siblings of a node.
A DocNode object is unique in an instance of a document
with respect to the Object.equals(Object) and
Object.hashCode()
methods. Note, however, that if a document is created multiple
times using the same root Node, the documents are
considered to be distinct and each document will
have its own set of DocNode objects.
| Field Summary |
|---|
| Fields inherited from interface org.planx.xmlstore.Node |
|---|
BINARY, CHARDATA, ELEMENT |
| Constructor Summary | |
|---|---|
DocNode(Node node)
Create a DocNode which is the root of a document. |
|
| Method Summary | |
|---|---|
int |
attributeCount()
Returns the number of attributes of this node. |
int |
childCount()
Returns the number of children of this node. |
boolean |
contentEquals(Node n)
Returns true if the underlying node is equal to
the specified node, otherwise false. |
DocAttribute |
getAttribute(int index)
Returns the attribute with the specified index. |
String |
getAttribute(String attrName)
Returns the attribute with the given name. |
String[] |
getAttributeNames()
Returns the names of this Node's attributes. |
List<Attribute> |
getAttributes()
Returns the attributes of this Node. |
byte[] |
getBytes()
Returns the value of this node as bytes. |
DocNode |
getChild(int index)
Returns the child with the specified index. |
List<? extends Node> |
getChildren()
Returns the children of this Node. |
List<DocAttribute> |
getDocAttributes()
|
List<DocNode> |
getDocChildren()
Returns a list that contains the children of this node as DocNodes. |
int |
getIndex()
Returns the index of this node in the parent's list of children. |
String |
getNodeValue()
Returns the value of this Node. |
DocNode |
getParent()
Returns the parent DocNode of this DocNode. |
int[] |
getPath()
Returns an integer array containing the path from the root to this node. |
DocNode |
getRootElement()
Returns the root element DocNode of the document that contains this DocNode. |
DocNode |
getRootNode()
Returns the root node DocNode of the document that contains this DocNode. |
byte |
getType()
Returns the node type of this Node. |
boolean |
isMutable()
Returns true if this Node is mutable,
false otherwise. |
DocNode |
nextSibling()
Returns the sibling node immediately following this node. |
DocNode |
previousSibling()
Returns the sibling node immediately preceding this node. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.planx.xmlstore.Node |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public DocNode(Node node)
node - the DVM Node| Method Detail |
|---|
public int[] getPath()
public DocNode getRootElement()
public DocNode getRootNode()
public DocNode getParent()
null is returned.
public int getIndex()
public DocNode getChild(int index)
public int childCount()
public List<DocNode> getDocChildren()
DocNodes.
public DocNode nextSibling()
public DocNode previousSibling()
public int attributeCount()
public DocAttribute getAttribute(int index)
public List<DocAttribute> getDocAttributes()
public boolean isMutable()
Nodetrue if this Node is mutable,
false otherwise.
isMutable in interface Nodetrue if mutable, false if immutable.public byte getType()
NodeNode.
getType in interface Nodepublic String getNodeValue()
NodeNode. When the node represents
a character data node, the returned value will be the character data.
When the node represents an element node, the returned value will
by the tag name of the element. When the node represents binary data,
the returned value will be a base64 encoding of the data.
getNodeValue in interface Nodepublic byte[] getBytes()
NodeBINARY nodes. For CHARDATA and
ELEMENT nodes the returned bytes will be
Node.getNodeValue() encoded as bytes using the default
character encoding.
getBytes in interface Nodepublic String getAttribute(String attrName)
Node
getAttribute in interface Nodepublic String[] getAttributeNames()
NodeNode's attributes.
If the node represents character data the returned array is empty.
getAttributeNames in interface Nodepublic List<? extends Node> getChildren()
NodeNode.
If the node represents character data the empty list is returned.
getChildren in interface NodeNode.public List<Attribute> getAttributes()
NodeNode. In case
the node represents character data, the empty list is returned.
getAttributes in interface NodeNode.public String toString()
toString in class Objectpublic boolean contentEquals(Node n)
true if the underlying node is equal to
the specified node, otherwise false. This
comparison, in other words, disregards the specific occurrence
of this node and only considers the content of it.
contentEquals in interface Node
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||