Xindice API
version 1.1

org.apache.xindice.xml.dom
Class NodeImpl

java.lang.Object
  |
  +--org.apache.xindice.xml.dom.NodeImpl
All Implemented Interfaces:
CompressedNode, DBNode, org.w3c.dom.Node
Direct Known Subclasses:
CharacterDataImpl, ContainerNodeImpl, DocumentTypeImpl, EntityImpl, EntityReferenceImpl, NotationImpl, ProcessingInstructionImpl

public abstract class NodeImpl
extends Object
implements CompressedNode, DBNode

NodeImpl implements the foundation of the Xindice compressed DOM.

Version:
$Revision: 518460 $, $Date: 2007-03-14 23:47:19 -0400 (Wed, 14 Mar 2007) $

Field Summary
protected  byte[] data
           
protected  boolean dirty
           
static short DOCUMENT_POSITION_CONTAINED_BY
          The node is contained by the reference node.
static short DOCUMENT_POSITION_CONTAINS
          The node contains the reference node.
static short DOCUMENT_POSITION_DISCONNECTED
          The two nodes are disconnected.
static short DOCUMENT_POSITION_FOLLOWING
          The node follows the reference node.
static short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC
          The determination of preceding versus following is implementation-specific.
static short DOCUMENT_POSITION_PRECEDING
          The second node precedes the reference node.
static org.w3c.dom.DOMException EX_DOMSTRING_SIZE
           
static org.w3c.dom.DOMException EX_HIERARCHY_REQUEST
           
static org.w3c.dom.DOMException EX_INDEX_SIZE
           
static org.w3c.dom.DOMException EX_INUSE_ATTRIBUTE
           
static org.w3c.dom.DOMException EX_INVALID_STATE
           
static org.w3c.dom.DOMException EX_NO_DATA_ALLOWED
           
static org.w3c.dom.DOMException EX_NO_MODIFICATION_ALLOWED
           
static org.w3c.dom.DOMException EX_NOT_FOUND
           
static org.w3c.dom.DOMException EX_WRONG_DOCUMENT
           
protected  HashMap handlers
           
protected  Object key
           
protected  int len
           
protected  boolean loaded
           
protected  String nodeName
           
protected  String nodeValue
           
protected  String nsURI
           
static String OBJECT_HREF
           
static String OBJECT_NS
           
static String OBJECT_TYPE
           
protected  org.w3c.dom.Document ownerDocument
           
protected  NodeImpl parentNode
           
protected  int pos
           
protected  NodeSource source
           
static String TYPE_APPEND
           
static String TYPE_CONTENT
           
static String TYPE_INSERT
           
static String TYPE_REPLACE
           
protected  HashMap userData
           
static String XMLNS_PREFIX
           
static String XMLNS_URI
           
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
NodeImpl()
          Create empty node
NodeImpl(NodeImpl parentNode, boolean dirty)
           
NodeImpl(NodeImpl parentNode, byte[] data, int pos, int len)
          Create node from compressed data
 
Method Summary
 org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
          Adds the node newChild to the end of the list of children of this node.
protected  void checkLoaded()
           
 void checkReadOnly()
           
 org.w3c.dom.Node cloneNode(boolean deep)
          Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.
protected  org.w3c.dom.Node cloneNode(boolean deep, boolean invokeHandler)
           
 short compareDocumentPosition(org.w3c.dom.Node other)
          Compares the reference node, i.e.
 void expandSource()
          expandSource expands the source into the Node as a namespace and a set of attributes.
 org.w3c.dom.NamedNodeMap getAttributes()
          A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.
 String getBaseURI()
           
 org.w3c.dom.NodeList getChildNodes()
          A NodeList that contains all children of this node.
 byte[] getDataBytes()
          getDataBytes returns the byte array that defines this Node.
 int getDataLen()
          getDataLen returns the length of the Node's definition in the byte array.
 int getDataPos()
          getDataPos returns the offset into the Node definition's byte array that the Node starts at.
 Object getFeature(String feature, String version)
           
 org.w3c.dom.Node getFirstChild()
          The first child of this node.
 org.w3c.dom.Node getLastChild()
          The last child of this node.
 String getLocalName()
          Returns the local part of the qualified name of this node.
 String getNamespaceURI()
          The namespace URI of this node, or null if it is unspecified.
 org.w3c.dom.Node getNextSibling()
          The node immediately following this node.
protected  org.w3c.dom.Node getNextSibling(org.w3c.dom.Node node)
           
 String getNodeName()
          The name of this node, depending on its type; see the table above.
abstract  short getNodeType()
          A code representing the type of the underlying object, as defined above.
 String getNodeValue()
          The value of this node, depending on its type; see the table above.
 org.w3c.dom.Document getOwnerDocument()
          The Document object associated with this node.
 org.w3c.dom.Node getParentNode()
          The parent of this node.
 String getPrefix()
          The namespace prefix of this node, or null if it is unspecified.
 org.w3c.dom.Node getPreviousSibling()
          The node immediately preceding this node.
protected  org.w3c.dom.Node getPreviousSibling(org.w3c.dom.Node node)
           
 NodeSource getSource()
          getSource returns a source for this Node.
 short getSymbolID()
          getSymbolID returns the Symbol ID for the current node.
 String getTextContent()
          This method returns the text content of this node and its descendants.
 Object getUserData(String key)
          This method allows to retreive a user object previously attached to a Node with setUserData.
 boolean hasAttributes()
           
 boolean hasChildNodes()
          This is a convenience method to allow easy determination of whether a node has any children.
 org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)
          Inserts the node newChild before the existing child node refChild.
protected  void invokeHandlers(short op, org.w3c.dom.Node dst)
           
protected  void invokeHandlers(short op, org.w3c.dom.Node src, org.w3c.dom.Node dst)
          Invoke user data handlers with provided parameters.
 boolean isDefaultNamespace(String namespaceURI)
           
 boolean isDefined()
           
 boolean isDirty()
          isDirty returns whether or not the current Node (or any of its children) have been modified since being loaded.
 boolean isEqualNode(org.w3c.dom.Node other)
          Tests whether two nodes are equal.
 boolean isLoaded()
          isLoaded returns whether or not the Node's definition has been loaded.
 boolean isSameNode(org.w3c.dom.Node other)
          Returns whether this node is the same node as the given one.
 boolean isSupported(String feature, String version)
          Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.
 void load()
          load forces the Node to be graphed for this level.
 String lookupDefaultNamespaceURI()
          getDefaultNamespaceURI returns the default Namespace URI in this scope.
 String lookupNamespaceURI(String prefix)
          Look up the namespace URI associated to the given prefix.
 String lookupPrefix(String namespaceURI)
          Look up the prefix associated to the given namespace URI, starting from this node.
 void normalize()
          Puts all Text nodes in the full depth of the sub-tree underneath this Node , including attribute nodes, into a "normal" form where only markup (e.g., tags, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes.
 org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
          Removes the child node indicated by oldChild from the list of children, and returns it.
 org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)
          Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
 void setDataBytes(byte[] data)
          setDataBytes sets the byte array that defines this Node.
 void setDataBytes(byte[] data, int pos, int len)
          setDataBytes sets the definition and positional information for the Node.
 void setDataLen(int len)
          setDataLen sets the length of the Node's definition in the byte array.
 void setDataPos(int pos)
          setDataPos sets the offset into the Node definition's byte array that the Node starts at.
 void setDirty()
           
 void setNodeName(String nodeName)
           
 void setNodeValue(String nodeValue)
          The value of this node, depending on its type; see the table above.
 void setParentNode(NodeImpl parentNode)
           
 void setPrefix(String prefix)
          The namespace prefix of this node, or null if it is unspecified.
 void setSource(NodeSource source)
          setSource sets a source for this Node.
 void setTextContent(String textContent)
          This method changes the text content of this node.
 Object setUserData(String key, Object data, org.w3c.dom.UserDataHandler handler)
          This method allows to attach a user object to a Node.
 String toString()
          Converts this node into its textual representation.
 void unload()
          unload forces the Node to be unloaded for this level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

XMLNS_PREFIX

public static final String XMLNS_PREFIX

OBJECT_NS

public static final String OBJECT_NS

OBJECT_HREF

public static final String OBJECT_HREF

OBJECT_TYPE

public static final String OBJECT_TYPE

TYPE_CONTENT

public static final String TYPE_CONTENT

TYPE_REPLACE

public static final String TYPE_REPLACE

TYPE_INSERT

public static final String TYPE_INSERT

TYPE_APPEND

public static final String TYPE_APPEND

XMLNS_URI

public static final String XMLNS_URI

EX_NO_MODIFICATION_ALLOWED

public static final org.w3c.dom.DOMException EX_NO_MODIFICATION_ALLOWED

EX_INUSE_ATTRIBUTE

public static final org.w3c.dom.DOMException EX_INUSE_ATTRIBUTE

EX_WRONG_DOCUMENT

public static final org.w3c.dom.DOMException EX_WRONG_DOCUMENT

EX_NOT_FOUND

public static final org.w3c.dom.DOMException EX_NOT_FOUND

EX_HIERARCHY_REQUEST

public static final org.w3c.dom.DOMException EX_HIERARCHY_REQUEST

EX_NO_DATA_ALLOWED

public static final org.w3c.dom.DOMException EX_NO_DATA_ALLOWED

EX_INVALID_STATE

public static final org.w3c.dom.DOMException EX_INVALID_STATE

EX_DOMSTRING_SIZE

public static final org.w3c.dom.DOMException EX_DOMSTRING_SIZE

EX_INDEX_SIZE

public static final org.w3c.dom.DOMException EX_INDEX_SIZE

DOCUMENT_POSITION_DISCONNECTED

public static final short DOCUMENT_POSITION_DISCONNECTED
The two nodes are disconnected. Order between disconnected nodes is always implementation-specific.

DOCUMENT_POSITION_PRECEDING

public static final short DOCUMENT_POSITION_PRECEDING
The second node precedes the reference node.

DOCUMENT_POSITION_FOLLOWING

public static final short DOCUMENT_POSITION_FOLLOWING
The node follows the reference node.

DOCUMENT_POSITION_CONTAINS

public static final short DOCUMENT_POSITION_CONTAINS
The node contains the reference node. A node which contains is always preceding, too.

DOCUMENT_POSITION_CONTAINED_BY

public static final short DOCUMENT_POSITION_CONTAINED_BY
The node is contained by the reference node. A node which is contained is always following, too.

DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC

public static final short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC
The determination of preceding versus following is implementation-specific.

source

protected NodeSource source

data

protected byte[] data

pos

protected int pos

len

protected int len

loaded

protected boolean loaded

dirty

protected boolean dirty

parentNode

protected NodeImpl parentNode

nodeName

protected String nodeName

nodeValue

protected String nodeValue

ownerDocument

protected org.w3c.dom.Document ownerDocument

nsURI

protected String nsURI

userData

protected HashMap userData

handlers

protected HashMap handlers

key

protected Object key
Constructor Detail

NodeImpl

public NodeImpl()
Create empty node

NodeImpl

public NodeImpl(NodeImpl parentNode,
                byte[] data,
                int pos,
                int len)
Create node from compressed data
Parameters:
parentNode - the parent node
data - compressed document data byte array
pos - offset in the data byte array
len - length of node's data

NodeImpl

public NodeImpl(NodeImpl parentNode,
                boolean dirty)
Method Detail

isLoaded

public final boolean isLoaded()
Description copied from interface: CompressedNode
isLoaded returns whether or not the Node's definition has been loaded.
Specified by:
isLoaded in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Returns:
Whether or not the Node is loaded

checkLoaded

protected void checkLoaded()

load

public void load()
Description copied from interface: CompressedNode
load forces the Node to be graphed for this level. Loading happens automatically whenever a Node's children are accessed, so load should never have to explicitly be called.
Specified by:
load in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Throws:
org.w3c.dom.DOMException - if an exception occurs

unload

public void unload()
Description copied from interface: CompressedNode
unload forces the Node to be unloaded for this level. Whether the node is actually unloaded or not is up to the underlying implementation, and should silently fail if the implementation doesn't support unloading.
Specified by:
unload in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Throws:
org.w3c.dom.DOMException - if an exception occurs

getSymbolID

public short getSymbolID()
Description copied from interface: CompressedNode
getSymbolID returns the Symbol ID for the current node. Some nodes will not have a Symbol ID, in which case, a value of -1 is returned.
Specified by:
getSymbolID in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Returns:
The Symbol ID

checkReadOnly

public final void checkReadOnly()
                         throws org.w3c.dom.DOMException

isDefined

public final boolean isDefined()

isDirty

public final boolean isDirty()
Description copied from interface: CompressedNode
isDirty returns whether or not the current Node (or any of its children) have been modified since being loaded.
Specified by:
isDirty in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Returns:
Whether or not the Node has been modified

setDirty

public final void setDirty()

getDataBytes

public byte[] getDataBytes()
Description copied from interface: CompressedNode
getDataBytes returns the byte array that defines this Node. A Node definition is usually a subset of this byte array.
Specified by:
getDataBytes in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Returns:
The Node definition's byte array

setDataBytes

public void setDataBytes(byte[] data,
                         int pos,
                         int len)
Description copied from interface: CompressedNode
setDataBytes sets the definition and positional information for the Node.
Specified by:
setDataBytes in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Parameters:
data - The Node definition's byte array
pos - The Node's position
len - The Node's length

setDataBytes

public void setDataBytes(byte[] data)
Description copied from interface: CompressedNode
setDataBytes sets the byte array that defines this Node.
Specified by:
setDataBytes in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Parameters:
data - The Node definition's byte array

getDataPos

public int getDataPos()
Description copied from interface: CompressedNode
getDataPos returns the offset into the Node definition's byte array that the Node starts at.
Specified by:
getDataPos in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Returns:
The Node's position

setDataPos

public void setDataPos(int pos)
Description copied from interface: CompressedNode
setDataPos sets the offset into the Node definition's byte array that the Node starts at.
Specified by:
setDataPos in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Parameters:
pos - The Node's position

getDataLen

public int getDataLen()
Description copied from interface: CompressedNode
getDataLen returns the length of the Node's definition in the byte array.
Specified by:
getDataLen in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Returns:
The Node's length

setDataLen

public void setDataLen(int len)
Description copied from interface: CompressedNode
setDataLen sets the length of the Node's definition in the byte array.
Specified by:
setDataLen in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Parameters:
len - The Node's length

setNodeName

public final void setNodeName(String nodeName)

setParentNode

public final void setParentNode(NodeImpl parentNode)

getPreviousSibling

protected org.w3c.dom.Node getPreviousSibling(org.w3c.dom.Node node)

getNextSibling

protected org.w3c.dom.Node getNextSibling(org.w3c.dom.Node node)

setSource

public final void setSource(NodeSource source)
Description copied from interface: DBNode
setSource sets a source for this Node.
Specified by:
setSource in interface DBNode
Following copied from interface: org.apache.xindice.xml.dom.DBNode
Parameters:
source - The Document source
Throws:
org.w3c.dom.DOMException - if an exception occurs

getSource

public final NodeSource getSource()
Description copied from interface: DBNode
getSource returns a source for this Node.
Specified by:
getSource in interface DBNode
Following copied from interface: org.apache.xindice.xml.dom.DBNode
Returns:
The Document source

expandSource

public void expandSource()
Description copied from interface: DBNode
expandSource expands the source into the Node as a namespace and a set of attributes. This method will only work on a Document or an Element, and should silently fail on all other Node types.
Specified by:
expandSource in interface DBNode

getNodeType

public abstract short getNodeType()
A code representing the type of the underlying object, as defined above.
Specified by:
getNodeType in interface org.w3c.dom.Node

getLastChild

public org.w3c.dom.Node getLastChild()
The last child of this node. If there is no such node, this returns null.
Specified by:
getLastChild in interface org.w3c.dom.Node

getPreviousSibling

public final org.w3c.dom.Node getPreviousSibling()
The node immediately preceding this node. If there is no such node, this returns null.
Specified by:
getPreviousSibling in interface org.w3c.dom.Node

getNextSibling

public final org.w3c.dom.Node getNextSibling()
The node immediately following this node. If there is no such node, this returns null.
Specified by:
getNextSibling in interface org.w3c.dom.Node

getAttributes

public org.w3c.dom.NamedNodeMap getAttributes()
A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.
Specified by:
getAttributes in interface org.w3c.dom.Node

hasAttributes

public boolean hasAttributes()
Specified by:
hasAttributes in interface org.w3c.dom.Node

getOwnerDocument

public final org.w3c.dom.Document getOwnerDocument()
The Document object associated with this node. This is also the Document object used to create new nodes. When this node is a Document this is null.
Specified by:
getOwnerDocument in interface org.w3c.dom.Node

insertBefore

public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node refChild)
                              throws org.w3c.dom.DOMException
Inserts the node newChild before the existing child node refChild. If refChild is null, insert newChild at the end of the list of children.
If newChild is a DocumentFragment object, all of its children are inserted, in the same order, before refChild. If the newChild is already in the tree, it is first removed.
Specified by:
insertBefore in interface org.w3c.dom.Node
Parameters:
newChild - The node to insert.
refChild - The reference node, i.e., the node before which the new node must be inserted.
Returns:
The node being inserted.
Throws:
org.w3c.dom.DOMException - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to insert is one of this node's ancestors.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_FOUND_ERR: Raised if refChild is not a child of this node.

getChildNodes

public org.w3c.dom.NodeList getChildNodes()
A NodeList that contains all children of this node. If there are no children, this is a NodeList containing no nodes. The content of the returned NodeList is "live" in the sense that, for instance, changes to the children of the node object that it was created from are immediately reflected in the nodes returned by the NodeList accessors; it is not a static snapshot of the content of the node. This is true for every NodeList, including the ones returned by the getElementsByTagName method.
Specified by:
getChildNodes in interface org.w3c.dom.Node

setNodeValue

public void setNodeValue(String nodeValue)
                  throws org.w3c.dom.DOMException
The value of this node, depending on its type; see the table above. When it is defined to be null , setting it has no effect.
Specified by:
setNodeValue in interface org.w3c.dom.Node
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
org.w3c.dom.DOMException - DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform.

getParentNode

public final org.w3c.dom.Node getParentNode()
The parent of this node. All nodes, except Document, DocumentFragment, and Attr may have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this is null.
Specified by:
getParentNode in interface org.w3c.dom.Node

getFirstChild

public org.w3c.dom.Node getFirstChild()
The first child of this node. If there is no such node, this returns null.
Specified by:
getFirstChild in interface org.w3c.dom.Node

getNodeName

public String getNodeName()
The name of this node, depending on its type; see the table above.
Specified by:
getNodeName in interface org.w3c.dom.Node

getNodeValue

public String getNodeValue()
                    throws org.w3c.dom.DOMException
The value of this node, depending on its type; see the table above.
Specified by:
getNodeValue in interface org.w3c.dom.Node
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
org.w3c.dom.DOMException - DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform.

replaceChild

public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node oldChild)
                              throws org.w3c.dom.DOMException
Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node. If the newChild is already in the tree, it is first removed.
Specified by:
replaceChild in interface org.w3c.dom.Node
Parameters:
newChild - The new node to put in the child list.
oldChild - The node being replaced in the list.
Returns:
The node replaced.
Throws:
org.w3c.dom.DOMException - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or it the node to put in is one of this node's ancestors.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_FOUND_ERR: Raised if oldChild is not a child of this node.

removeChild

public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
                             throws org.w3c.dom.DOMException
Removes the child node indicated by oldChild from the list of children, and returns it.
Specified by:
removeChild in interface org.w3c.dom.Node
Parameters:
oldChild - The node being removed.
Returns:
The node removed.
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_FOUND_ERR: Raised if oldChild is not a child of this node.

appendChild

public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
                             throws org.w3c.dom.DOMException
Adds the node newChild to the end of the list of children of this node. If the newChild is already in the tree, it is first removed.
Specified by:
appendChild in interface org.w3c.dom.Node
Parameters:
newChild - The node to add.If it is a DocumentFragment object, the entire contents of the document fragment are moved into the child list of this node
Returns:
The node added.
Throws:
org.w3c.dom.DOMException - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to append is one of this node's ancestors.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

hasChildNodes

public boolean hasChildNodes()
This is a convenience method to allow easy determination of whether a node has any children.
Specified by:
hasChildNodes in interface org.w3c.dom.Node
Returns:
true if the node has any children, false if the node has no children.

cloneNode

public final org.w3c.dom.Node cloneNode(boolean deep)
Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent ( parentNode returns null.).
Cloning an Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text node. Cloning any other type of node simply returns a copy of this node.
Specified by:
cloneNode in interface org.w3c.dom.Node
Parameters:
deep - If true, recursively clone the subtree under the specified node; if false, clone only the node itself (and its attributes, if it is an Element).
Returns:
The duplicate node.

cloneNode

protected final org.w3c.dom.Node cloneNode(boolean deep,
                                           boolean invokeHandler)

normalize

public void normalize()
Puts all Text nodes in the full depth of the sub-tree underneath this Node , including attribute nodes, into a "normal" form where only markup (e.g., tags, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointer lookups) that depend on a particular document tree structure are to be used. In cases where the document contains CDATASections , the normalize operation alone may not be sufficient, since XPointers do not differentiate between Text nodes and CDATASection nodes.
Specified by:
normalize in interface org.w3c.dom.Node
Since:
DOM Level 2

isSupported

public final boolean isSupported(String feature,
                                 String version)
Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.
Specified by:
isSupported in interface org.w3c.dom.Node
Parameters:
feature - The name of the feature to test. This is the same name which can be passed to the method hasFeature on DOMImplementation .
version - This is the version number of the feature to test. In Level 2, version 1, this is the string "2.0". If the version is not specified, supporting any version of the feature will cause the method to return true .
Returns:
Returns true if the specified feature is supported on this node, false otherwise.
Since:
DOM Level 2

getNamespaceURI

public final String getNamespaceURI()
The namespace URI of this node, or null if it is unspecified.
This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace URI given at creation time.
For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always null . Per the Namespaces in XML Specification an attribute does not inherit its namespace from the element it is attached to. If an attribute is not explicitly given a namespace, it simply has no namespace.
Specified by:
getNamespaceURI in interface org.w3c.dom.Node
Since:
DOM Level 2

getPrefix

public final String getPrefix()
The namespace prefix of this node, or null if it is unspecified.
Note that setting this attribute, when permitted, changes the nodeName attribute, which holds the qualified name , as well as the tagName and name attributes of the Element and Attr interfaces, when applicable.
Note also that changing the prefix of an attribute that is known to have a default value, does not make a new attribute with the default value and the original prefix appear, since the namespaceURI and localName do not change.
Specified by:
getPrefix in interface org.w3c.dom.Node
Throws:
org.w3c.dom.DOMException - INVALID_CHARACTER_ERR: Raised if the specified prefix contains an illegal character.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NAMESPACE_ERR: Raised if the specified prefix is malformed, if the namespaceURI of this node is null , if the specified prefix is "xml" and the namespaceURI of this node is different from "http://www.w3.org/XML/1998/namespace", if this node is an attribute and the specified prefix is "xmlns" and the namespaceURI of this node is different from "http://www.w3.org/2000/xmlns/", or if this node is an attribute and the qualifiedName of this node is "xmlns" .
Since:
DOM Level 2

setPrefix

public final void setPrefix(String prefix)
The namespace prefix of this node, or null if it is unspecified.
Note that setting this attribute, when permitted, changes the nodeName attribute, which holds the qualified name , as well as the tagName and name attributes of the Element and Attr interfaces, when applicable.
Note also that changing the prefix of an attribute that is known to have a default value, does not make a new attribute with the default value and the original prefix appear, since the namespaceURI and localName do not change.
Specified by:
setPrefix in interface org.w3c.dom.Node
Throws:
org.w3c.dom.DOMException - INVALID_CHARACTER_ERR: Raised if the specified prefix contains an illegal character.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NAMESPACE_ERR: Raised if the specified prefix is malformed, if the namespaceURI of this node is null , if the specified prefix is "xml" and the namespaceURI of this node is different from "http://www.w3.org/XML/1998/namespace", if this node is an attribute and the specified prefix is "xmlns" and the namespaceURI of this node is different from "http://www.w3.org/2000/xmlns/", or if this node is an attribute and the qualifiedName of this node is "xmlns" .
Since:
DOM Level 2

getLocalName

public final String getLocalName()
Returns the local part of the qualified name of this node.
For nodes created with a DOM Level 1 method, such as createElement from the Document interface, it is null .
Specified by:
getLocalName in interface org.w3c.dom.Node
Since:
DOM Level 2

lookupDefaultNamespaceURI

public final String lookupDefaultNamespaceURI()
getDefaultNamespaceURI returns the default Namespace URI in this scope.
Returns:
The URI (or null)

isSameNode

public final boolean isSameNode(org.w3c.dom.Node other)
Returns whether this node is the same node as the given one.
Parameters:
other - The node to test against.
Returns:
Returns true if the nodes are the same, false otherwise.
Since:
DOM Level 3

lookupPrefix

public final String lookupPrefix(String namespaceURI)
Look up the prefix associated to the given namespace URI, starting from this node. The default namespace declarations are ignored by this method.
Parameters:
namespaceURI - The namespace URI to look for.
Returns:
Returns the associated namespace prefix or null if none is found.
Since:
DOM Level 3

lookupNamespaceURI

public final String lookupNamespaceURI(String prefix)
Look up the namespace URI associated to the given prefix. Starts from this node.Name. May need to change depending on ending of the relative namespace URI reference nightmare.
Parameters:
prefix - The prefix to look for.
Returns:
Returns the associated namespace URI or null if none is found.
Since:
DOM Level 3

setUserData

public final Object setUserData(String key,
                                Object data,
                                org.w3c.dom.UserDataHandler handler)
This method allows to attach a user object to a Node. This object can then be retreived using getUserData.Is this really worth it?Could we live without a key?What happens if the node is cloned, imported, adopted? Should some event mechanism be specified to notify the application?What happens if the node is cloned?What should Object be mapped to in ECMAScript? For IDL we need to define this type somehow.
Parameters:
data - The piece of data to attach to this node.
key - The key to associate this data to.
Returns:
The object previously associated to this node and the given key or null.
Since:
DOM Level 3

getUserData

public final Object getUserData(String key)
This method allows to retreive a user object previously attached to a Node with setUserData.
Parameters:
key - The key to look for.
Returns:
The object associated to this node and the given key or null.
Since:
DOM Level 3

getBaseURI

public String getBaseURI()
Since:
DOM Level 3

getTextContent

public String getTextContent()
This method returns the text content of this node and its descendants. No serialization is performed, the returned string does not contain any markup. No whitespace normalization is performed and the returned string does not contain the white spaces in element content (see the attribute Text.isElementContentWhitespace).
The string returned is made of the text content of this node depending on its type, as defined below:
Node typeContent
ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, DOCUMENT_FRAGMENT_NODE concatenation of the textContent attribute value of every child node, excluding COMMENT_NODE and PROCESSING_INSTRUCTION_NODE nodes. This is the empty string if the node has no children.
TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODEnodeValue
DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE null
Returns:
the text content of this node and its descendants
Since:
DOM Level 3

setTextContent

public void setTextContent(String textContent)
                    throws org.w3c.dom.DOMException
This method changes the text content of this node. When it is defined to be null, setting it has no effect. On setting, any possible children this node may have are removed and, if it the new string is not empty or null, replaced by a single Text node containing the string this attribute is set to. No parsing is performed, the input string is taken as pure textual content.
Parameters:
textContent - new text content
Throws:
org.w3c.dom.DOMException - - NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly

isEqualNode

public boolean isEqualNode(org.w3c.dom.Node other)
Tests whether two nodes are equal. This method tests for equality of nodes, not sameness (i.e., whether the two nodes are references to the same object) which can be tested with Node.isSameNode(). All nodes that are the same will also be equal, though the reverse may not be true.
Two nodes are equal if and only if the following conditions are satisfied:
For two DocumentType nodes to be equal, the following conditions must also be satisfied:
On the other hand, the following do not affect equality: the ownerDocument, baseURI, and parentNode attributes, the specified attribute for Attr nodes, the schemaTypeInfo attribute for Attr and Element nodes, the Text.isElementContentWhitespace attribute for Text nodes, as well as any user data or event listeners registered on the nodes.
Parameters:
other - Node to test againts
Returns:
true if nodes are equal, false otherwise
Since:
DOM Level 3

getFeature

public Object getFeature(String feature,
                         String version)
Since:
DOM Level 3

isDefaultNamespace

public boolean isDefaultNamespace(String namespaceURI)
Since:
DOM Level 3

compareDocumentPosition

public short compareDocumentPosition(org.w3c.dom.Node other)
                              throws org.w3c.dom.DOMException
Compares the reference node, i.e. the node on which this method is being called, with a node, i.e. the one passed as a parameter, with regard to their position in the document and according to the document order.
Parameters:
other - The node to compare against the reference node.
Returns:
Returns how the node is positioned relatively to the reference node.
Throws:
org.w3c.dom.DOMException - NOT_SUPPORTED_ERR: when the compared nodes are from different DOM implementations that do not coordinate to return consistent implementation-specific results.
Since:
DOM Level 3

invokeHandlers

protected void invokeHandlers(short op,
                              org.w3c.dom.Node src,
                              org.w3c.dom.Node dst)
Invoke user data handlers with provided parameters.

invokeHandlers

protected void invokeHandlers(short op,
                              org.w3c.dom.Node dst)

toString

public String toString()
Converts this node into its textual representation.
Overrides:
toString in class Object

Xindice API
version 1.1

Copyright (c) 1999-2007 The Apache Software Foundation. All Rights Reserved.