org.exist.dom
Class NodeImpl

java.lang.Object
  extended byorg.exist.dom.NodeImpl
All Implemented Interfaces:
org.w3c.dom.Node
Direct Known Subclasses:
AttrImpl, CharacterDataImpl, DocumentImpl, DocumentTypeImpl, ElementImpl, ProcessingInstructionImpl

public class NodeImpl
extends java.lang.Object
implements org.w3c.dom.Node

The base class for all DOM objects.

Author:
Wolfgang Meier

Field Summary
protected  short attributes
           
protected  long gid
           
protected  long internalAddress
           
protected  java.lang.String nodeName
           
protected  int nodeNameRef
           
protected  short nodeType
           
protected  DocumentImpl ownerDocument
           
 
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()
          Constructor for the NodeImpl object
NodeImpl(long gid)
          Constructor for the NodeImpl object
NodeImpl(org.w3c.dom.Node n)
          Constructor for the NodeImpl object
NodeImpl(short nodeType)
          Constructor for the NodeImpl object
NodeImpl(short nodeType, long gid)
          Constructor for the NodeImpl object
NodeImpl(short nodeType, java.lang.String nodeName)
          Constructor for the NodeImpl object
NodeImpl(short nodeType, java.lang.String nodeName, long gid)
          Constructor for the NodeImpl object
 
Method Summary
 org.w3c.dom.Node appendChild(org.w3c.dom.Node child)
           
 org.w3c.dom.Node appendChildren(org.w3c.dom.NodeList nodes)
           
 void clear()
          Reset this object to its initial state.
 org.w3c.dom.Node cloneNode(boolean deep)
           
static NodeImpl deserialize(byte[] data, int start, int len, DocumentImpl doc)
          Deserialize a node from a byte array.
 boolean equals(java.lang.Object obj)
           
 long firstChildID()
          Description of the Method
 org.w3c.dom.NamedNodeMap getAttributes()
           
 short getAttributesCount()
          Method getAttributesCount.
 DBBroker getBroker()
          Gets the broker attribute of the NodeImpl object
 int getChildCount()
          Method getChildCount.
 org.w3c.dom.NodeList getChildNodes()
          Gets the childNodes attribute of the NodeImpl object
 org.w3c.dom.Node getFirstChild()
           
 long getGID()
          Get the unique identifier assigned to this node
 long getInternalAddress()
          Get the internal storage address of this node
 org.w3c.dom.Node getLastChild()
           
protected  NodeImpl getLastNode(java.util.Iterator iterator, NodeImpl node)
           
protected  NodeImpl getLastNode(NodeImpl node)
           
 java.lang.String getLocalName()
           
 java.lang.String getNamespaceURI()
           
 org.w3c.dom.Node getNextSibling()
           
 java.lang.String getNodeName()
           
 int getNodeNameRef()
          Returns the nodeNameRef.
 short getNodeType()
           
 java.lang.String getNodeValue()
           
 org.w3c.dom.Document getOwnerDocument()
           
 long getParentGID()
          Get the unique node identifier of this node's parent node.
 org.w3c.dom.Node getParentNode()
           
 java.lang.StringBuffer getPath()
           
 java.lang.String getPrefix()
           
 org.w3c.dom.Node getPreviousSibling()
           
 boolean hasAttributes()
           
 boolean hasChildNodes()
           
 org.w3c.dom.Node insertAfter(org.w3c.dom.NodeList nodes, org.w3c.dom.Node refChild)
           
 org.w3c.dom.Node insertAfter(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)
           
 org.w3c.dom.Node insertBefore(org.w3c.dom.NodeList nodes, org.w3c.dom.Node refChild)
           
 org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)
           
 boolean isSupported(java.lang.String key, java.lang.String value)
           
 long lastChildID()
          Get the unique node identifier of the last child of this node.
 void normalize()
           
 org.w3c.dom.Node removeChild(org.w3c.dom.Node node)
           
 org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)
           
 byte[] serialize()
           
 void setAttributes(short attribNum)
          Set the attributes that belong to this node.
protected  void setChildCount(int count)
          Set the number of children.
 void setGID(long gid)
          Set the unique node identifier of this node.
 void setInternalAddress(long address)
          Set the internal storage address of this node.
 void setNodeName(java.lang.String name)
          Set the node name.
 void setNodeNameRef(int nodeNameRef)
          Sets the nodeNameRef.
 void setNodeValue(java.lang.String value)
          Set the node value.
 void setOwnerDocument(org.w3c.dom.Document doc)
          Set the owner document.
 void setPrefix(java.lang.String prefix)
          Sets the prefix attribute of the NodeImpl object
 boolean supports(java.lang.String feature, java.lang.String version)
          Method supports.
 void toSAX(org.xml.sax.ContentHandler contentHandler, org.xml.sax.ext.LexicalHandler lexicalHandler, boolean first)
          Description of the Method
 void toSAX(org.xml.sax.ContentHandler contentHandler, org.xml.sax.ext.LexicalHandler lexicalHandler, boolean first, java.util.ArrayList prefixes)
          Description of the Method
 java.lang.String toString()
          Description of the Method
 java.lang.String toString(boolean top)
          Description of the Method
 void updateChild(org.w3c.dom.Node oldChild, org.w3c.dom.Node newChild)
          Update a child node.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

attributes

protected short attributes

gid

protected long gid

internalAddress

protected long internalAddress

nodeName

protected java.lang.String nodeName

nodeNameRef

protected int nodeNameRef

nodeType

protected short nodeType

ownerDocument

protected DocumentImpl ownerDocument
Constructor Detail

NodeImpl

public NodeImpl()
Constructor for the NodeImpl object


NodeImpl

public NodeImpl(short nodeType)
Constructor for the NodeImpl object

Parameters:
nodeType - Description of the Parameter

NodeImpl

public NodeImpl(org.w3c.dom.Node n)
Constructor for the NodeImpl object

Parameters:
n - Description of the Parameter

NodeImpl

public NodeImpl(long gid)
Constructor for the NodeImpl object

Parameters:
gid - Description of the Parameter

NodeImpl

public NodeImpl(short nodeType,
                long gid)
Constructor for the NodeImpl object

Parameters:
nodeType - Description of the Parameter
gid - Description of the Parameter

NodeImpl

public NodeImpl(short nodeType,
                java.lang.String nodeName)
Constructor for the NodeImpl object

Parameters:
nodeType - Description of the Parameter
nodeName - Description of the Parameter

NodeImpl

public NodeImpl(short nodeType,
                java.lang.String nodeName,
                long gid)
Constructor for the NodeImpl object

Parameters:
nodeType - Description of the Parameter
nodeName - Description of the Parameter
gid - Description of the Parameter
Method Detail

deserialize

public static NodeImpl deserialize(byte[] data,
                                   int start,
                                   int len,
                                   DocumentImpl doc)
Deserialize a node from a byte array.

Parameters:
data - Description of the Parameter
doc - Description of the Parameter
Returns:
Description of the Return Value

clear

public void clear()
Reset this object to its initial state. Required by the parser to be able to reuse node objects.


appendChild

public org.w3c.dom.Node appendChild(org.w3c.dom.Node child)
                             throws org.w3c.dom.DOMException
Specified by:
appendChild in interface org.w3c.dom.Node
Throws:
org.w3c.dom.DOMException
See Also:
Node.appendChild(org.w3c.dom.Node)

appendChildren

public org.w3c.dom.Node appendChildren(org.w3c.dom.NodeList nodes)
                                throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

cloneNode

public org.w3c.dom.Node cloneNode(boolean deep)
Specified by:
cloneNode in interface org.w3c.dom.Node
See Also:
Node.cloneNode(boolean)

equals

public boolean equals(java.lang.Object obj)
See Also:
Object.equals(java.lang.Object)

firstChildID

public long firstChildID()
Description of the Method

Returns:
Description of the Return Value

getAttributes

public org.w3c.dom.NamedNodeMap getAttributes()
Specified by:
getAttributes in interface org.w3c.dom.Node
See Also:
Node.getAttributes()

getAttributesCount

public short getAttributesCount()
Method getAttributesCount.

Returns:
short

getBroker

public DBBroker getBroker()
Gets the broker attribute of the NodeImpl object

Returns:
The broker value

getChildCount

public int getChildCount()
Method getChildCount.

Returns:
int

getChildNodes

public org.w3c.dom.NodeList getChildNodes()
Gets the childNodes attribute of the NodeImpl object

Specified by:
getChildNodes in interface org.w3c.dom.Node
Returns:
The childNodes value

getFirstChild

public org.w3c.dom.Node getFirstChild()
Specified by:
getFirstChild in interface org.w3c.dom.Node
See Also:
Node.getFirstChild()

getGID

public long getGID()
Get the unique identifier assigned to this node

Returns:
The gID value

getInternalAddress

public long getInternalAddress()
Get the internal storage address of this node

Returns:
The internalAddress value

getLastChild

public org.w3c.dom.Node getLastChild()
Specified by:
getLastChild in interface org.w3c.dom.Node
See Also:
Node.getLastChild()

getLocalName

public java.lang.String getLocalName()
Specified by:
getLocalName in interface org.w3c.dom.Node
See Also:
Node.getLocalName()

getNamespaceURI

public java.lang.String getNamespaceURI()
Specified by:
getNamespaceURI in interface org.w3c.dom.Node
See Also:
Node.getNamespaceURI()

getNodeName

public java.lang.String getNodeName()
Specified by:
getNodeName in interface org.w3c.dom.Node
See Also:
Node.getNodeName()

getNodeType

public short getNodeType()
Specified by:
getNodeType in interface org.w3c.dom.Node
See Also:
Node.getNodeType()

getNodeValue

public java.lang.String getNodeValue()
                              throws org.w3c.dom.DOMException
Specified by:
getNodeValue in interface org.w3c.dom.Node
Throws:
org.w3c.dom.DOMException
See Also:
Node.getNodeValue()

getOwnerDocument

public org.w3c.dom.Document getOwnerDocument()
Specified by:
getOwnerDocument in interface org.w3c.dom.Node
See Also:
Node.getOwnerDocument()

getParentGID

public long getParentGID()
Get the unique node identifier of this node's parent node.

Returns:
The parentGID value

getParentNode

public org.w3c.dom.Node getParentNode()
Specified by:
getParentNode in interface org.w3c.dom.Node
See Also:
Node.getParentNode()

getPath

public java.lang.StringBuffer getPath()

getPrefix

public java.lang.String getPrefix()
Specified by:
getPrefix in interface org.w3c.dom.Node
See Also:
Node.getPrefix()

getPreviousSibling

public org.w3c.dom.Node getPreviousSibling()
Specified by:
getPreviousSibling in interface org.w3c.dom.Node
See Also:
Node.getPreviousSibling()

getNextSibling

public org.w3c.dom.Node getNextSibling()
Specified by:
getNextSibling in interface org.w3c.dom.Node
See Also:
Node.getNextSibling()

hasAttributes

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

hasChildNodes

public boolean hasChildNodes()
Specified by:
hasChildNodes in interface org.w3c.dom.Node
See Also:
Node.hasChildNodes()

insertBefore

public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node refChild)
                              throws org.w3c.dom.DOMException
Specified by:
insertBefore in interface org.w3c.dom.Node
Throws:
org.w3c.dom.DOMException
See Also:
Node.insertBefore(org.w3c.dom.Node, org.w3c.dom.Node)

insertAfter

public org.w3c.dom.Node insertAfter(org.w3c.dom.Node newChild,
                                    org.w3c.dom.Node refChild)
                             throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

insertAfter

public org.w3c.dom.Node insertAfter(org.w3c.dom.NodeList nodes,
                                    org.w3c.dom.Node refChild)
                             throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

insertBefore

public org.w3c.dom.Node insertBefore(org.w3c.dom.NodeList nodes,
                                     org.w3c.dom.Node refChild)
                              throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

isSupported

public boolean isSupported(java.lang.String key,
                           java.lang.String value)
Specified by:
isSupported in interface org.w3c.dom.Node
See Also:
Node.isSupported(java.lang.String, java.lang.String)

lastChildID

public long lastChildID()
Get the unique node identifier of the last child of this node.

Returns:
Description of the Return Value

normalize

public void normalize()
Specified by:
normalize in interface org.w3c.dom.Node
See Also:
Node.normalize()

removeChild

public org.w3c.dom.Node removeChild(org.w3c.dom.Node node)
                             throws org.w3c.dom.DOMException
Specified by:
removeChild in interface org.w3c.dom.Node
Throws:
org.w3c.dom.DOMException
See Also:
Node.removeChild(org.w3c.dom.Node)

replaceChild

public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node oldChild)
                              throws org.w3c.dom.DOMException
Specified by:
replaceChild in interface org.w3c.dom.Node
Throws:
org.w3c.dom.DOMException
See Also:
Node.replaceChild(org.w3c.dom.Node, org.w3c.dom.Node)

serialize

public byte[] serialize()

setAttributes

public void setAttributes(short attribNum)
Set the attributes that belong to this node.

Parameters:
attribNum - The new attributes value

setChildCount

protected void setChildCount(int count)
Set the number of children.

Parameters:
count - The new childCount value

setGID

public void setGID(long gid)
Set the unique node identifier of this node.

Parameters:
gid - The new gID value

setInternalAddress

public void setInternalAddress(long address)
Set the internal storage address of this node.

Parameters:
address - The new internalAddress value

setNodeName

public void setNodeName(java.lang.String name)
Set the node name.

Parameters:
name - The new nodeName value

setNodeValue

public void setNodeValue(java.lang.String value)
                  throws org.w3c.dom.DOMException
Set the node value.

Specified by:
setNodeValue in interface org.w3c.dom.Node
Parameters:
value - The new nodeValue value
Throws:
org.w3c.dom.DOMException - Description of the Exception

setOwnerDocument

public void setOwnerDocument(org.w3c.dom.Document doc)
Set the owner document.

Parameters:
doc - The new ownerDocument value

setPrefix

public void setPrefix(java.lang.String prefix)
               throws org.w3c.dom.DOMException
Sets the prefix attribute of the NodeImpl object

Specified by:
setPrefix in interface org.w3c.dom.Node
Parameters:
prefix - The new prefix value
Throws:
org.w3c.dom.DOMException - Description of the Exception

supports

public boolean supports(java.lang.String feature,
                        java.lang.String version)
Method supports.

Parameters:
feature -
version -
Returns:
boolean

toSAX

public void toSAX(org.xml.sax.ContentHandler contentHandler,
                  org.xml.sax.ext.LexicalHandler lexicalHandler,
                  boolean first)
           throws org.xml.sax.SAXException
Description of the Method

Parameters:
contentHandler - Description of the Parameter
lexicalHandler - Description of the Parameter
first - Description of the Parameter
Throws:
org.xml.sax.SAXException - Description of the Exception

toSAX

public void toSAX(org.xml.sax.ContentHandler contentHandler,
                  org.xml.sax.ext.LexicalHandler lexicalHandler,
                  boolean first,
                  java.util.ArrayList prefixes)
           throws org.xml.sax.SAXException
Description of the Method

Parameters:
contentHandler - Description of the Parameter
lexicalHandler - Description of the Parameter
first - Description of the Parameter
prefixes - Description of the Parameter
Throws:
org.xml.sax.SAXException - Description of the Exception

toString

public java.lang.String toString()
Description of the Method

Returns:
Description of the Return Value

toString

public java.lang.String toString(boolean top)
Description of the Method

Parameters:
top - Description of the Parameter
Returns:
Description of the Return Value

getNodeNameRef

public int getNodeNameRef()
Returns the nodeNameRef.

Returns:
int

setNodeNameRef

public void setNodeNameRef(int nodeNameRef)
Sets the nodeNameRef.

Parameters:
nodeNameRef - The nodeNameRef to set

getLastNode

protected NodeImpl getLastNode(NodeImpl node)

getLastNode

protected NodeImpl getLastNode(java.util.Iterator iterator,
                               NodeImpl node)

updateChild

public void updateChild(org.w3c.dom.Node oldChild,
                        org.w3c.dom.Node newChild)
                 throws org.w3c.dom.DOMException
Update a child node. This method will only update the child node but not its potential descendant nodes.

Parameters:
oldChild -
newChild -
Throws:
org.w3c.dom.DOMException


Copyright (C) Wolfgang Meier. All rights reserved.