org.planx.xmlstore
Interface Node

All Known Subinterfaces:
SystemNode
All Known Implementing Classes:
AbstractDVMNode, BlockingNodeProxy, DocNode, DVMBinaryNode, DVMCharDataNode, DVMElementNode, LoadableNodeProxy, NodeProxy, XMLStoreNodeProxy

public interface Node

A Node. XML node types should be contained as a subset of the available node types. Currently, only XML ELEMENT and CHARDATA nodes are supported. One additional (non-XML) type is available: BINARY.

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

Field Summary
static byte BINARY
          Node type binary data.
static byte CHARDATA
          Node type character data.
static byte ELEMENT
          Node type element.
 
Method Summary
 boolean contentEquals(Node n)
          Returns true if and only if the specified node has the same type, value, and attributes as this node, and their children recursively satisfy the same predicate.
 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.
 byte[] getBytes()
          Returns the value of this node as bytes.
 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

BINARY

static final byte BINARY
Node type binary 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. When the node represents binary data, the returned value will be a base64 encoding of the data.

Returns:
The node value.

getBytes

byte[] getBytes()
Returns the value of this node as bytes. This is most useful for BINARY nodes. For CHARDATA and ELEMENT nodes the returned bytes will be getNodeValue() encoded as bytes using the default character encoding.


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

contentEquals

boolean contentEquals(Node n)
Returns true if and only if the specified node has the same type, value, and attributes as this node, and their children recursively satisfy the same predicate.


hashCode

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

Overrides:
hashCode in class Object


Copyright © 2004-2005 Plan-X. All Rights Reserved.