org.exist.dom
Class ElementImpl

java.lang.Object
  extended byorg.exist.dom.NodeImpl
      extended byorg.exist.dom.ElementImpl
All Implemented Interfaces:
org.w3c.dom.Element, org.w3c.dom.Node

public class ElementImpl
extends NodeImpl
implements org.w3c.dom.Element

ElementImpl.java

Author:
Wolfgang Meier

Field Summary
protected  int children
           
protected  long firstChild
           
protected  java.util.ArrayList prefixes
           
 
Fields inherited from class org.exist.dom.NodeImpl
attributes, gid, internalAddress, nodeName, nodeNameRef, nodeType, 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
ElementImpl()
          Constructor for the ElementImpl object
ElementImpl(long gid)
          Constructor for the ElementImpl object
ElementImpl(long gid, java.lang.String nodeName)
          Constructor for the ElementImpl object
ElementImpl(java.lang.String nodeName)
          Constructor for the ElementImpl object
 
Method Summary
 void addNamespacePrefix(java.lang.String prefix)
           
 void addPrefix(java.lang.String pfx)
           
 org.w3c.dom.Node appendChild(org.w3c.dom.Node child)
           
 void appendChildInternal(NodeImpl child)
          Append a child to this node.
protected  org.w3c.dom.Node appendChildren(long gid, NodeImpl last, org.w3c.dom.NodeList nodes, boolean index)
          Internal append.
 org.w3c.dom.Node appendChildren(org.w3c.dom.NodeList nodes)
           
 void clear()
          Reset this element to its initial state.
 boolean declaresNamespacePrefixes()
          Description of the Method
static NodeImpl deserialize(byte[] data, int start, int len, DocumentImpl doc)
          Description of the Method
 long firstChildID()
          Description of the Method
 java.lang.String getAttribute(java.lang.String name)
           
 org.w3c.dom.Attr getAttributeNode(java.lang.String name)
           
 org.w3c.dom.Attr getAttributeNodeNS(java.lang.String namespaceURI, java.lang.String localName)
           
 java.lang.String getAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
           
 org.w3c.dom.NamedNodeMap getAttributes()
           
 int getChildCount()
          Method getChildCount.
 org.w3c.dom.NodeList getChildNodes()
          Gets the childNodes attribute of the NodeImpl object
 org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagName)
           
 org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)
           
 org.w3c.dom.Node getFirstChild()
           
 org.w3c.dom.Node getLastChild()
           
 java.util.Iterator getNamespacePrefixes()
          Gets the namespacePrefixes attribute of the DocumentImpl object
 java.lang.String getNamespaceURI()
           
 java.lang.String getNodeName()
           
 java.lang.String getNodeValue()
           
 int getSymbol()
           
 java.lang.String getTagName()
           
 boolean hasAttribute(java.lang.String name)
           
 boolean hasAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
           
 boolean hasAttributes()
           
 boolean hasChildNodes()
           
 org.w3c.dom.Node insertAfter(org.w3c.dom.NodeList nodes, org.w3c.dom.Node refChild)
          Insert a list of nodes at the position following the reference child.
 org.w3c.dom.Node insertBefore(org.w3c.dom.NodeList nodes, org.w3c.dom.Node refChild)
          Insert a list of nodes at the position before the reference child.
 org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)
           
 long lastChildID()
          Description of the Method
 void removeAttribute(java.lang.String name)
           
 org.w3c.dom.Attr removeAttributeNode(org.w3c.dom.Attr oldAttr)
          Description of the Method
 void removeAttributeNS(java.lang.String namespaceURI, java.lang.String name)
           
 org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
           
 org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)
           
 byte[] serialize()
          Description of the Method
 void setAttribute(java.lang.String name, java.lang.String value)
          Sets the attribute attribute of the ElementImpl object
 org.w3c.dom.Attr setAttributeNode(org.w3c.dom.Attr newAttr)
          Sets the attributeNode attribute of the ElementImpl object
 org.w3c.dom.Attr setAttributeNodeNS(org.w3c.dom.Attr newAttr)
          Sets the attributeNodeNS attribute of the ElementImpl object
 void setAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String value)
          Sets the attributeNS attribute of the ElementImpl object
 void setChildCount(int count)
          Sets the childCount attribute of the ElementImpl object
 void setNodeName(java.lang.String name)
          Sets the nodeName attribute of the ElementImpl object
 void setPrefixes(java.util.Collection pfx)
          Sets the prefixes attribute of the ElementImpl object
 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
 java.lang.String toString(boolean top, java.util.ArrayList prefixes)
          Method toString.
 void update(org.w3c.dom.NodeList newContent)
          Update the contents of this element.
 void updateChild(org.w3c.dom.Node oldChild, org.w3c.dom.Node newChild)
          Update a child node.
 
Methods inherited from class org.exist.dom.NodeImpl
cloneNode, equals, getAttributesCount, getBroker, getGID, getInternalAddress, getLastNode, getLastNode, getLocalName, getNextSibling, getNodeNameRef, getNodeType, getOwnerDocument, getParentGID, getParentNode, getPath, getPrefix, getPreviousSibling, insertAfter, isSupported, normalize, setAttributes, setGID, setInternalAddress, setNodeNameRef, setNodeValue, setOwnerDocument, setPrefix, supports, toSAX
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Node
cloneNode, getLocalName, getNextSibling, getNodeType, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, isSupported, normalize, setNodeValue, setPrefix
 

Field Detail

children

protected int children

firstChild

protected long firstChild

prefixes

protected java.util.ArrayList prefixes
Constructor Detail

ElementImpl

public ElementImpl()
Constructor for the ElementImpl object


ElementImpl

public ElementImpl(long gid)
Constructor for the ElementImpl object

Parameters:
gid - Description of the Parameter

ElementImpl

public ElementImpl(java.lang.String nodeName)
Constructor for the ElementImpl object

Parameters:
nodeName - Description of the Parameter

ElementImpl

public ElementImpl(long gid,
                   java.lang.String nodeName)
Constructor for the ElementImpl object

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

clear

public void clear()
Reset this element to its initial state.

Overrides:
clear in class NodeImpl
See Also:
NodeImpl.clear()

deserialize

public static NodeImpl deserialize(byte[] data,
                                   int start,
                                   int len,
                                   DocumentImpl doc)
Description of the Method

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

getSymbol

public int getSymbol()

addNamespacePrefix

public void addNamespacePrefix(java.lang.String prefix)

appendChildInternal

public void appendChildInternal(NodeImpl child)
                         throws org.w3c.dom.DOMException
Append a child to this node. This method does not rearrange the node tree and is only used internally by the parser.

Parameters:
child -
Throws:
org.w3c.dom.DOMException

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
Overrides:
appendChild in class NodeImpl
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
Overrides:
appendChildren in class NodeImpl
Throws:
org.w3c.dom.DOMException

appendChildren

protected org.w3c.dom.Node appendChildren(long gid,
                                          NodeImpl last,
                                          org.w3c.dom.NodeList nodes,
                                          boolean index)
                                   throws org.w3c.dom.DOMException
Internal append.

Parameters:
last -
Returns:
Node
Throws:
org.w3c.dom.DOMException

getNamespaceURI

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

declaresNamespacePrefixes

public boolean declaresNamespacePrefixes()
Description of the Method

Returns:
Description of the Return Value

firstChildID

public long firstChildID()
Description copied from class: NodeImpl
Description of the Method

Overrides:
firstChildID in class NodeImpl
Returns:
Description of the Return Value
See Also:
NodeImpl.firstChildID()

getAttribute

public java.lang.String getAttribute(java.lang.String name)
Specified by:
getAttribute in interface org.w3c.dom.Element
See Also:
Element.getAttribute(java.lang.String)

getAttributeNS

public java.lang.String getAttributeNS(java.lang.String namespaceURI,
                                       java.lang.String localName)
Specified by:
getAttributeNS in interface org.w3c.dom.Element
See Also:
Element.getAttributeNS(java.lang.String, java.lang.String)

getAttributeNode

public org.w3c.dom.Attr getAttributeNode(java.lang.String name)
Specified by:
getAttributeNode in interface org.w3c.dom.Element
See Also:
Element.getAttributeNode(java.lang.String)

getAttributeNodeNS

public org.w3c.dom.Attr getAttributeNodeNS(java.lang.String namespaceURI,
                                           java.lang.String localName)
Specified by:
getAttributeNodeNS in interface org.w3c.dom.Element
See Also:
Element.getAttributeNodeNS(java.lang.String, java.lang.String)

getAttributes

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

getChildCount

public int getChildCount()
Description copied from class: NodeImpl
Method getChildCount.

Overrides:
getChildCount in class NodeImpl
Returns:
int
See Also:
NodeImpl.getChildCount()

getChildNodes

public org.w3c.dom.NodeList getChildNodes()
Description copied from class: NodeImpl
Gets the childNodes attribute of the NodeImpl object

Specified by:
getChildNodes in interface org.w3c.dom.Node
Overrides:
getChildNodes in class NodeImpl
Returns:
The childNodes value
See Also:
Node.getChildNodes()

getElementsByTagName

public org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagName)
Specified by:
getElementsByTagName in interface org.w3c.dom.Element
See Also:
Element.getElementsByTagName(java.lang.String)

getElementsByTagNameNS

public org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI,
                                                   java.lang.String localName)
Specified by:
getElementsByTagNameNS in interface org.w3c.dom.Element
See Also:
Element.getElementsByTagNameNS(java.lang.String, java.lang.String)

getFirstChild

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

getLastChild

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

getNamespacePrefixes

public java.util.Iterator getNamespacePrefixes()
Gets the namespacePrefixes attribute of the DocumentImpl object

Returns:
The namespacePrefixes value

getNodeName

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

getNodeValue

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

getTagName

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

hasAttribute

public boolean hasAttribute(java.lang.String name)
Specified by:
hasAttribute in interface org.w3c.dom.Element
See Also:
Element.hasAttribute(java.lang.String)

hasAttributeNS

public boolean hasAttributeNS(java.lang.String namespaceURI,
                              java.lang.String localName)
Specified by:
hasAttributeNS in interface org.w3c.dom.Element
See Also:
Element.hasAttributeNS(java.lang.String, java.lang.String)

hasAttributes

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

hasChildNodes

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

lastChildID

public long lastChildID()
Description of the Method

Overrides:
lastChildID in class NodeImpl
Returns:
Description of the Return Value

removeAttribute

public void removeAttribute(java.lang.String name)
                     throws org.w3c.dom.DOMException
Specified by:
removeAttribute in interface org.w3c.dom.Element
Throws:
org.w3c.dom.DOMException
See Also:
Element.removeAttribute(java.lang.String)

removeAttributeNS

public void removeAttributeNS(java.lang.String namespaceURI,
                              java.lang.String name)
                       throws org.w3c.dom.DOMException
Specified by:
removeAttributeNS in interface org.w3c.dom.Element
Throws:
org.w3c.dom.DOMException
See Also:
Element.removeAttributeNS(java.lang.String, java.lang.String)

removeAttributeNode

public org.w3c.dom.Attr removeAttributeNode(org.w3c.dom.Attr oldAttr)
                                     throws org.w3c.dom.DOMException
Description of the Method

Specified by:
removeAttributeNode in interface org.w3c.dom.Element
Parameters:
oldAttr - Description of the Parameter
Returns:
Description of the Return Value
Throws:
org.w3c.dom.DOMException - Description of the Exception

serialize

public byte[] serialize()
Description of the Method

Overrides:
serialize in class NodeImpl
Returns:
Description of the Return Value

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)
                  throws org.w3c.dom.DOMException
Sets the attribute attribute of the ElementImpl object

Specified by:
setAttribute in interface org.w3c.dom.Element
Parameters:
name - The new attribute value
value - The new attribute value
Throws:
org.w3c.dom.DOMException - Description of the Exception

setAttributeNS

public void setAttributeNS(java.lang.String namespaceURI,
                           java.lang.String qualifiedName,
                           java.lang.String value)
                    throws org.w3c.dom.DOMException
Sets the attributeNS attribute of the ElementImpl object

Specified by:
setAttributeNS in interface org.w3c.dom.Element
Parameters:
namespaceURI - The new attributeNS value
qualifiedName - The new attributeNS value
value - The new attributeNS value
Throws:
org.w3c.dom.DOMException - Description of the Exception

setAttributeNode

public org.w3c.dom.Attr setAttributeNode(org.w3c.dom.Attr newAttr)
                                  throws org.w3c.dom.DOMException
Sets the attributeNode attribute of the ElementImpl object

Specified by:
setAttributeNode in interface org.w3c.dom.Element
Parameters:
newAttr - The new attributeNode value
Returns:
Description of the Return Value
Throws:
org.w3c.dom.DOMException - Description of the Exception

setAttributeNodeNS

public org.w3c.dom.Attr setAttributeNodeNS(org.w3c.dom.Attr newAttr)
Sets the attributeNodeNS attribute of the ElementImpl object

Specified by:
setAttributeNodeNS in interface org.w3c.dom.Element
Parameters:
newAttr - The new attributeNodeNS value
Returns:
Description of the Return Value

setChildCount

public void setChildCount(int count)
Sets the childCount attribute of the ElementImpl object

Overrides:
setChildCount in class NodeImpl
Parameters:
count - The new childCount value

setNodeName

public void setNodeName(java.lang.String name)
Sets the nodeName attribute of the ElementImpl object

Overrides:
setNodeName in class NodeImpl
Parameters:
name - The new nodeName value

setPrefixes

public void setPrefixes(java.util.Collection pfx)
Sets the prefixes attribute of the ElementImpl object

Parameters:
pfx - The new prefixes value

addPrefix

public void addPrefix(java.lang.String pfx)

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

Overrides:
toSAX in class NodeImpl
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 copied from class: NodeImpl
Description of the Method

Overrides:
toString in class NodeImpl
Returns:
Description of the Return Value
See Also:
Object.toString()

toString

public java.lang.String toString(boolean top)
Description copied from class: NodeImpl
Description of the Method

Overrides:
toString in class NodeImpl
Parameters:
top - Description of the Parameter
Returns:
Description of the Return Value
See Also:
NodeImpl.toString(boolean)

toString

public java.lang.String toString(boolean top,
                                 java.util.ArrayList prefixes)
Method toString.

Parameters:
top -
prefixes -
Returns:
String

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
Overrides:
insertBefore in class NodeImpl
Throws:
org.w3c.dom.DOMException
See Also:
Node.insertBefore(org.w3c.dom.Node, org.w3c.dom.Node)

insertBefore

public org.w3c.dom.Node insertBefore(org.w3c.dom.NodeList nodes,
                                     org.w3c.dom.Node refChild)
                              throws org.w3c.dom.DOMException
Insert a list of nodes at the position before the reference child.

Overrides:
insertBefore in class NodeImpl
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
Insert a list of nodes at the position following the reference child.

Overrides:
insertAfter in class NodeImpl
Throws:
org.w3c.dom.DOMException

update

public void update(org.w3c.dom.NodeList newContent)
            throws org.w3c.dom.DOMException
Update the contents of this element. The passed list of nodes becomes the new content.

Parameters:
newContent -
Throws:
org.w3c.dom.DOMException

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.

Overrides:
updateChild in class NodeImpl
Parameters:
oldChild -
newChild -
Throws:
org.w3c.dom.DOMException

removeChild

public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
                             throws org.w3c.dom.DOMException
Specified by:
removeChild in interface org.w3c.dom.Node
Overrides:
removeChild in class NodeImpl
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
Overrides:
replaceChild in class NodeImpl
Throws:
org.w3c.dom.DOMException
See Also:
Node.replaceChild(org.w3c.dom.Node, org.w3c.dom.Node)


Copyright (C) Wolfgang Meier. All rights reserved.