com.icl.saxon.tree

Class ParentNodeImpl

Implemented Interfaces:
DOMLocator, Node, NodeInfo, Source, SourceLocator
Known Direct Subclasses:
DocumentImpl, ElementImpl

(package private) abstract class ParentNodeImpl
extends NodeImpl

ParentNodeImpl is an implementation of a non-leaf node (specifically, an Element node or a Document node)
Author:
Michael H. Kay

Field Summary

protected int
sequence

Fields inherited from class com.icl.saxon.tree.NodeImpl

emptyArray, index, parent

Fields inherited from class com.icl.saxon.om.AbstractNode

NODE_LETTER

Fields inherited from interface com.icl.saxon.om.NodeInfo

ATTRIBUTE, COMMENT, ELEMENT, NAMESPACE, NODE, NONE, NUMBER_OF_TYPES, PI, ROOT, TEXT

Method Summary

void
addChild(NodeImpl node, int index)
Add a child node to this node.
void
compact(int size)
Compact the space used by this node
void
copyStringValue(Outputter out)
Copy the string-value of this node to a given outputter
void
dropChildren()
Drop a branch of the tree.
AxisEnumeration
enumerateChildren(NodeTest test)
Get an enumeration of the children of this node
NodeList
getChildNodes()
Return a NodeList that contains all children of this node.
Node
getFirstChild()
Get the first child node of the element
Node
getLastChild()
Get the last child node of the element
String
getNodeValue()
Get the node value as defined in the DOM.
protected NodeImpl
getNthChild(int n)
Get the nth child node of the element (numbering from 0)
protected long
getSequenceNumber()
Get the node sequence number (in document order).
String
getStringValue()
Return the string-value of the node, that is, the concatenation of the character content of all descendent elements and text nodes.
boolean
hasChildNodes()
Determine if the node has any children.
void
removeChild(int index)
Remove node at given index.
void
renumberChildren()
Renumber the children of a given parent node.
void
useChildrenArray(NodeImpl[] array)
Supply an array to be used for the array of children.

Methods inherited from class com.icl.saxon.tree.NodeImpl

compareOrder, generateId, getAttributeValue, getAttributeValue, getAttributes, getBaseURI, getChildNodes, getDisplayName, getDocumentElement, getDocumentRoot, getEnumeration, getFingerprint, getFirstChild, getLastChild, getLineNumber, getLocalName, getNameCode, getNamePool, getNextInDocument, getNextSibling, getOriginatingNode, getParent, getPrefix, getPreviousInDocument, getPreviousSibling, getSequenceNumber, getSystemId, getURI, hasAttributes, hasChildNodes, isSameNodeInfo, outputNamespaceNodes, removeNode, setSystemId

Methods inherited from class com.icl.saxon.om.AbstractNode

appendChild, appendData, cloneNode, compareDocumentPosition, compareOrder, copyStringValue, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, deleteData, disallowUpdate, generateId, getAttribute, getAttributeNS, getAttributeNode, getAttributeNodeNS, getAttributeValue, getAttributeValue, getAttributes, getBaseURI, getChildNodes, getColumnNumber, getData, getDisplayName, getDoctype, getDocumentElement, getDocumentRoot, getElementById, getElementsByTagName, getElementsByTagNameNS, getEnumeration, getFeature, getFingerprint, getFirstChild, getImplementation, getLastChild, getLength, getLineNumber, getLocalName, getName, getNameCode, getNamespaceURI, getNextSibling, getNodeName, getNodeValue, getOriginatingNode, getOwnerDocument, getOwnerElement, getParent, getParentNode, getPrefix, getPreviousSibling, getPublicId, getSchemaTypeInfo, getSpecified, getSystemId, getTagName, getTextContent, getURI, getUserData, getValue, getWholeText, hasAttribute, hasAttributeNS, hasAttributes, hasChildNodes, importNode, insertBefore, insertData, isDefaultNamespace, isElementContentWhitespace, isEqualNode, isId, isSameNode, isSameNodeInfo, isSupported, lookupNamespaceURI, lookupPrefix, normalize, outputNamespaceNodes, removeAttribute, removeAttributeNS, removeAttributeNode, removeChild, replaceChild, replaceData, replaceWholeText, setAttributeNS, setAttributeNode, setAttributeNodeNS, setData, setIdAttribute, setIdAttributeNS, setIdAttributeNode, setNodeValue, setPrefix, setTextContent, setUserData, setValue, splitText, substringData, supports

Field Details

sequence

protected int sequence

Method Details

addChild

public void addChild(NodeImpl node,
                     int index)
Add a child node to this node. For system use only. Note: normalizing adjacent text nodes is the responsibility of the caller.

compact

public void compact(int size)
Compact the space used by this node

copyStringValue

public void copyStringValue(Outputter out)
            throws TransformerException
Copy the string-value of this node to a given outputter
Specified by:
copyStringValue in interface NodeInfo
Overrides:
copyStringValue in interface AbstractNode

dropChildren

public void dropChildren()
Drop a branch of the tree. The target element remains in the tree, but its children are disconnected from the parent. Unless there are other references to the children (e.g. in a variable) they will be deleted from memory next time the garbage collector comes round.

enumerateChildren

public final AxisEnumeration enumerateChildren(NodeTest test)
Get an enumeration of the children of this node

getChildNodes

public final NodeList getChildNodes()
Return a NodeList that contains all children of this node. If there are no children, this is a NodeList containing no nodes.
Overrides:
getChildNodes in interface NodeImpl

getFirstChild

public final Node getFirstChild()
Get the first child node of the element
Overrides:
getFirstChild in interface NodeImpl
Returns:
the first child node of the required type, or null if there are no children

getLastChild

public final Node getLastChild()
Get the last child node of the element
Overrides:
getLastChild in interface NodeImpl
Returns:
the last child of the element, or null if there are no children

getNodeValue

public String getNodeValue()
Get the node value as defined in the DOM. This is not the same as the XPath string-value.
Overrides:
getNodeValue in interface AbstractNode

getNthChild

protected final NodeImpl getNthChild(int n)
Get the nth child node of the element (numbering from 0)
Returns:
the last child of the element, or null if there is no n'th child

getSequenceNumber

protected final long getSequenceNumber()
Get the node sequence number (in document order). Sequence numbers are monotonic but not consecutive. In the current implementation, parent nodes (elements and roots) have a zero least-significant word, while namespaces, attributes, text nodes, comments, and PIs have the top word the same as their owner and the bottom half reflecting their relative position.
Overrides:
getSequenceNumber in interface NodeImpl

getStringValue

public String getStringValue()
Return the string-value of the node, that is, the concatenation of the character content of all descendent elements and text nodes.
Specified by:
getStringValue in interface NodeInfo
Returns:
the accumulated character content of the element, including descendant elements.

hasChildNodes

public final boolean hasChildNodes()
Determine if the node has any children.
Specified by:
hasChildNodes in interface NodeInfo
Overrides:
hasChildNodes in interface NodeImpl

removeChild

public void removeChild(int index)
Remove node at given index. Will always be followed by a renumberChildren().

renumberChildren

public void renumberChildren()
Renumber the children of a given parent node. For system use only

useChildrenArray

public void useChildrenArray(NodeImpl[] array)
Supply an array to be used for the array of children. For system use only.