org.planx.xmlstore
Interface Node

All Known Subinterfaces:
SystemNode
All Known Implementing Classes:
AbstractNode, BlockingNodeProxy, DocNode, DVMNode, NodeProxy, XMLStoreNodeProxy

public interface Node

An XML Node. Currently, only element nodes and character data nodes are supported.

Author:
Kasper Bøgebjerg, Henning Niss, Thomas Ambus

Field Summary
static byte CHARDATA
          Node type character data.
static byte ELEMENT
          Node type element.
 
Method Summary
 boolean equals(Object o)
          Returns true if and only if the specified object is also a Node, they have the same type, their node values are equal, their attributes are equals as a set, and their children are recursively equal according to this definition.
 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.
 List<? extends Node> getChildren()
          Returns the children of this Node.
 String getNodeValue()
          Returns the value of this Node.
 byte getType()
          Returns the node type of this Node.
 int hashCode()
          Recursively computes a hash code based on the node type, node value, attributes, and children.
 boolean isMutable()
          Returns true if this Node is mutable, false otherwise.
 

Field Detail

ELEMENT

static final byte ELEMENT
Node type element. The Node has a value, attributes, and children.

See Also:
Constant Field Values

CHARDATA

static final byte CHARDATA
Node type character data. The Node only has a value.

See Also:
Constant Field Values
Method Detail

isMutable

boolean isMutable()
Returns true if this Node is mutable, false otherwise.

Returns:
true if mutable, false if immutable.

getType

byte getType()
Returns the node type of this Node.

Returns:
The node type

getNodeValue

String getNodeValue()
Returns the value of this Node. 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.

Returns:
The node value.

getAttributes

List<Attribute> getAttributes()
Returns the attributes of this Node. In case the node represents character data, the empty list is returned.

Returns:
An immutable list of the attributes of this Node.

getAttribute

String getAttribute(String attrName)
Returns the attribute with the given name. In case the node represents a character data node the returned value is null.

Returns:
The attribute named by the argument.

getAttributeNames

String[] getAttributeNames()
Returns the names of this Node's attributes. If the node represents character data the returned array is empty.

Returns:
The attribute names of the node.

getChildren

List<? extends Node> getChildren()
Returns the children of this Node. If the node represents character data the empty list is returned.

Returns:
An immutable list of the children of this Node.

equals

boolean equals(Object o)
Returns true if and only if the specified object is also a Node, they have the same type, their node values are equal, their attributes are equals as a set, and their children are recursively equal according to this definition.

Overrides:
equals in class Object

hashCode

int hashCode()
Recursively computes a hash code based on the node type, node value, attributes, and children.

Overrides:
hashCode in class Object


Copyright © 2010. All Rights Reserved.