Xindice API
version 1.1

org.apache.xindice.xml.dom
Class ContainerNodeImpl

java.lang.Object
  |
  +--org.apache.xindice.xml.dom.NodeImpl
        |
        +--org.apache.xindice.xml.dom.ContainerNodeImpl
All Implemented Interfaces:
CompressedNode, DBNode, org.w3c.dom.Node
Direct Known Subclasses:
AttrImpl, DocumentFragmentImpl, DocumentImpl, ElementImpl

public abstract class ContainerNodeImpl
extends NodeImpl

ContainerNodeImpl performs most of the child-rearing behavior of the Element and Document implementations.

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

Field Summary
protected  NodeListImpl childNodes
           
 
Fields inherited from class org.apache.xindice.xml.dom.NodeImpl
data, dirty, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, EX_DOMSTRING_SIZE, EX_HIERARCHY_REQUEST, EX_INDEX_SIZE, EX_INUSE_ATTRIBUTE, EX_INVALID_STATE, EX_NO_DATA_ALLOWED, EX_NO_MODIFICATION_ALLOWED, EX_NOT_FOUND, EX_WRONG_DOCUMENT, handlers, key, len, loaded, nodeName, nodeValue, nsURI, OBJECT_HREF, OBJECT_NS, OBJECT_TYPE, ownerDocument, parentNode, pos, source, TYPE_APPEND, TYPE_CONTENT, TYPE_INSERT, TYPE_REPLACE, userData, XMLNS_PREFIX, 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
ContainerNodeImpl()
           
ContainerNodeImpl(NodeImpl parentNode, boolean dirty)
           
ContainerNodeImpl(NodeImpl parentNode, byte[] data, int pos, int len)
           
 
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()
           
 org.w3c.dom.NodeList getChildNodes()
          A NodeList that contains all children of this node.
 org.w3c.dom.Element getElementById(String elementId)
           
 org.w3c.dom.NodeList getElementsByTagName(String name)
          Returns a NodeList of all descendant elements with a given tag name, in the order in which they would be encountered in a preorder traversal of the Element tree.
 org.w3c.dom.NodeList getElementsByTagNameNS(String namespaceURI, String localName)
           
 org.w3c.dom.Node getFirstChild()
          The first child of this node.
 org.w3c.dom.Node getLastChild()
          The last child of this node.
protected  org.w3c.dom.Node getNextSibling(org.w3c.dom.Node node)
           
protected  org.w3c.dom.Node getPreviousSibling(org.w3c.dom.Node node)
           
 String getTextContent()
          This method returns the text content of this node and its descendants.
 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.
 boolean isEqualNode(org.w3c.dom.Node other)
          Tests whether two nodes are equal.
protected  boolean isNodeTypeValid(short type)
           
protected  void loadChildren(SymbolTable st)
           
 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.
 
Methods inherited from class org.apache.xindice.xml.dom.NodeImpl
checkReadOnly, cloneNode, cloneNode, compareDocumentPosition, expandSource, getAttributes, getBaseURI, getDataBytes, getDataLen, getDataPos, getFeature, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getSource, getSymbolID, getUserData, hasAttributes, invokeHandlers, invokeHandlers, isDefaultNamespace, isDefined, isDirty, isLoaded, isSameNode, isSupported, load, lookupDefaultNamespaceURI, lookupNamespaceURI, lookupPrefix, setDataBytes, setDataBytes, setDataLen, setDataPos, setDirty, setNodeName, setNodeValue, setParentNode, setPrefix, setSource, setTextContent, setUserData, toString, unload
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

childNodes

protected NodeListImpl childNodes
Constructor Detail

ContainerNodeImpl

public ContainerNodeImpl()

ContainerNodeImpl

public ContainerNodeImpl(NodeImpl parentNode,
                         byte[] data,
                         int pos,
                         int len)

ContainerNodeImpl

public ContainerNodeImpl(NodeImpl parentNode,
                         boolean dirty)
Method Detail

isNodeTypeValid

protected boolean isNodeTypeValid(short type)

getPreviousSibling

protected final org.w3c.dom.Node getPreviousSibling(org.w3c.dom.Node node)
Overrides:
getPreviousSibling in class NodeImpl

getNextSibling

protected final org.w3c.dom.Node getNextSibling(org.w3c.dom.Node node)
Overrides:
getNextSibling in class NodeImpl

checkLoaded

protected void checkLoaded()
Overrides:
checkLoaded in class NodeImpl

loadChildren

protected final void loadChildren(SymbolTable st)
                           throws IOException

hasChildNodes

public final boolean hasChildNodes()
This is a convenience method to allow easy determination of whether a node has any children.
Overrides:
hasChildNodes in class NodeImpl
Returns:
true if the node has any children, false if the node has no children.

getChildNodes

public final org.w3c.dom.NodeList getChildNodes()
Description copied from class: NodeImpl
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.
Overrides:
getChildNodes in class NodeImpl

getFirstChild

public final org.w3c.dom.Node getFirstChild()
The first child of this node. If there is no such node, this returns null.
Overrides:
getFirstChild in class NodeImpl

getLastChild

public final org.w3c.dom.Node getLastChild()
The last child of this node. If there is no such node, this returns null.
Overrides:
getLastChild in class NodeImpl

replaceChild

public final 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.
Overrides:
replaceChild in class NodeImpl
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.

insertBefore

public final 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.
Overrides:
insertBefore in class NodeImpl
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.

removeChild

public final 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.
Overrides:
removeChild in class NodeImpl
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 final 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.
Overrides:
appendChild in class NodeImpl
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.

normalize

public final 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.
Overrides:
normalize in class NodeImpl
Since:
DOM Level 2

getElementsByTagName

public final org.w3c.dom.NodeList getElementsByTagName(String name)
Returns a NodeList of all descendant elements with a given tag name, in the order in which they would be encountered in a preorder traversal of the Element tree.
Parameters:
name - The name of the tag to match on. The special value "*" matches all tags.
Returns:
A list of matching Element nodes.

getElementsByTagNameNS

public final org.w3c.dom.NodeList getElementsByTagNameNS(String namespaceURI,
                                                         String localName)

getElementById

public final org.w3c.dom.Element getElementById(String elementId)

getTextContent

public String getTextContent()
Description copied from class: NodeImpl
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
Overrides:
getTextContent in class NodeImpl
Since:
DOM Level 3

isEqualNode

public boolean isEqualNode(org.w3c.dom.Node other)
Description copied from class: NodeImpl
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.
Overrides:
isEqualNode in class NodeImpl
Since:
DOM Level 3

Xindice API
version 1.1

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