com.icl.saxon.tree

Class DocumentImpl

Implemented Interfaces:
Document, DocumentInfo, DOMLocator, Node, NodeInfo, Source, SourceLocator

public final class DocumentImpl
extends com.icl.saxon.tree.ParentNodeImpl
implements DocumentInfo, Document

A node in the XML parse tree representing the Document itself (or equivalently, the root node of the Document).

Nested Class Summary

Field Summary

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

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

Constructor Summary

DocumentImpl()

Method Summary

void
copy(Outputter out)
Copy this node to a given outputter
String
generateId()
Get a character string that uniquely identifies this node within the document
protected AxisEnumeration
getAllElements(int fingerprint)
Get a list of all elements with a given name fingerprint
String
getBaseURI()
Get the base URI of this root node.
StringBuffer
getCharacterBuffer()
Get the character buffer
Element
getDocumentElement()
Get the root (outermost) element.
DocumentInfo
getDocumentRoot()
Get the root (document) node
Hashtable
getKeyIndex(KeyManager keymanager, int fingerprint)
Get the index for a given key
int
getLineNumber()
Get the line number of this root node.
protected int
getLineNumber(int sequence)
Get the line number for an element.
NamePool
getNamePool()
Get the name pool used for the names in this document
Node
getNextSibling()
Get next sibling - always null
NodeFactory
getNodeFactory()
Get the node factory that was used to build this document
short
getNodeType()
Return the type of node.
Node
getPreviousSibling()
Get previous sibling - always null
String
getSystemId()
Get the system id of this root node
protected String
getSystemId(int seq)
Get the system id of an element in the document
String
getUnparsedEntity(String name)
Get the unparsed entity with a given name
NodeInfo
selectID(String id)
Get the element with a given ID.
protected void
setCharacterBuffer(StringBuffer buffer)
Set the character buffer
protected void
setDocumentElement(ElementImpl e)
Set the top-level element of the document (variously called the root element or the document element).
void
setKeyIndex(KeyManager keymanager, int fingerprint, Hashtable keyindex)
Set the index for a given key.
protected void
setLineNumber(int sequence, int line)
Set the line number for an element.
void
setLineNumbering()
Set line numbering on
void
setNamePool(NamePool pool)
Set the name pool used for all names in this document
void
setNodeFactory(NodeFactory factory)
Set the node factory that was used to build this document
void
setSystemId(String uri)
Set the system id of this node
protected void
setSystemId(int seq, String uri)
Set the system id of an element in the document
protected void
setUnparsedEntity(String name, String uri)
Set an unparsed entity URI associated with this document.

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

addChild, compact, copyStringValue, dropChildren, enumerateChildren, getChildNodes, getFirstChild, getLastChild, getNodeValue, getNthChild, getSequenceNumber, getStringValue, hasChildNodes, removeChild, renumberChildren, useChildrenArray

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, isSameNode, outputNamespaceNodes, removeNode, setSystemId

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

appendChild, appendData, cloneNode, 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, getFingerprint, getFirstChild, getImplementation, getLastChild, getLength, getLineNumber, getLocalName, getName, getNameCode, getNamespaceURI, getNextSibling, getNodeName, getNodeValue, getOriginatingNode, getOwnerDocument, getOwnerElement, getParent, getParentNode, getPrefix, getPreviousSibling, getPublicId, getSpecified, getSystemId, getTagName, getURI, getValue, hasAttribute, hasAttributeNS, hasAttributes, hasChildNodes, importNode, insertBefore, insertData, isSameNode, isSupported, normalize, outputNamespaceNodes, removeAttribute, removeAttributeNS, removeAttributeNode, removeChild, replaceChild, replaceData, setAttributeNS, setAttributeNode, setAttributeNodeNS, setData, setNodeValue, setPrefix, setValue, splitText, substringData, supports

Constructor Details

DocumentImpl

public DocumentImpl()

Method Details

copy

public void copy(Outputter out)
            throws TransformerException
Copy this node to a given outputter
Specified by:
copy in interface NodeInfo


generateId

public String generateId()
Get a character string that uniquely identifies this node within the document
Specified by:
generateId in interface NodeInfo
Overrides:
generateId in interface NodeImpl

Returns:
the empty string


getAllElements

protected AxisEnumeration getAllElements(int fingerprint)
Get a list of all elements with a given name fingerprint


getBaseURI

public String getBaseURI()
Get the base URI of this root node. For a root node the base URI is the same as the System ID.
Specified by:
getBaseURI in interface NodeInfo
Overrides:
getBaseURI in interface NodeImpl


getCharacterBuffer

public final StringBuffer getCharacterBuffer()
Get the character buffer


getDocumentElement

public Element getDocumentElement()
Get the root (outermost) element.
Overrides:
getDocumentElement in interface NodeImpl

Returns:
the Element node for the outermost element of the document.


getDocumentRoot

public DocumentInfo getDocumentRoot()
Get the root (document) node
Specified by:
getDocumentRoot in interface NodeInfo
Overrides:
getDocumentRoot in interface NodeImpl

Returns:
the DocumentInfo representing this document


getKeyIndex

public Hashtable getKeyIndex(KeyManager keymanager,
                             int fingerprint)
Get the index for a given key
Specified by:
getKeyIndex in interface DocumentInfo

Parameters:
keymanager - The key manager managing this key
fingerprint - The fingerprint of the name of the key (unique with the key manager)

Returns:
The index, if one has been built, in the form of a Hashtable that maps the key value to a Vector of nodes having that key value. If no index has been built, returns null.


getLineNumber

public int getLineNumber()
Get the line number of this root node.
Specified by:
getLineNumber in interface NodeInfo
Overrides:
getLineNumber in interface NodeImpl

Returns:
0 always


getLineNumber

protected int getLineNumber(int sequence)
Get the line number for an element. Return -1 if line numbering is off.


getNamePool

public NamePool getNamePool()
Get the name pool used for the names in this document
Specified by:
getNamePool in interface DocumentInfo
Overrides:
getNamePool in interface NodeImpl


getNextSibling

public final Node getNextSibling()
Get next sibling - always null
Overrides:
getNextSibling in interface NodeImpl

Returns:
null


getNodeFactory

public NodeFactory getNodeFactory()
Get the node factory that was used to build this document


getNodeType

public final short getNodeType()
Return the type of node.
Specified by:
getNodeType in interface NodeInfo

Returns:
NodeInfo.ROOT (always)


getPreviousSibling

public final Node getPreviousSibling()
Get previous sibling - always null
Overrides:
getPreviousSibling in interface NodeImpl

Returns:
null


getSystemId

public String getSystemId()
Get the system id of this root node
Specified by:
getSystemId in interface NodeInfo
Overrides:
getSystemId in interface NodeImpl


getSystemId

protected String getSystemId(int seq)
Get the system id of an element in the document


getUnparsedEntity

public String getUnparsedEntity(String name)
Get the unparsed entity with a given name
Specified by:
getUnparsedEntity in interface DocumentInfo

Parameters:
name - the name of the entity

Returns:
the URI of the entity if there is one, or empty string if not


selectID

public NodeInfo selectID(String id)
Get the element with a given ID.
Specified by:
selectID in interface DocumentInfo

Parameters:
id - The unique ID of the required element, previously registered using registerID()

Returns:
The NodeInfo for the given ID if one has been registered, otherwise null.


setCharacterBuffer

protected void setCharacterBuffer(StringBuffer buffer)
Set the character buffer


setDocumentElement

protected void setDocumentElement(ElementImpl e)
Set the top-level element of the document (variously called the root element or the document element). Note that a DocumentImpl may represent the root of a result tree fragment, in which case there is no document element.

Parameters:
e - the top-level element


setKeyIndex

public void setKeyIndex(KeyManager keymanager,
                        int fingerprint,
                        Hashtable keyindex)
Set the index for a given key. The method is synchronized because the same document can be used by several stylesheets at the same time.
Specified by:
setKeyIndex in interface DocumentInfo

Parameters:
keymanager - The key manager managing this key
fingerprint - The fingerprint of the name of the key (unique with the key manager)
keyindex - the index, in the form of a Hashtable that maps the key value to a Vector of nodes having that key value. Or the String "under construction", indicating that the index is being built.


setLineNumber

protected void setLineNumber(int sequence,
                             int line)
Set the line number for an element. Ignored if line numbering is off.


setLineNumbering

public void setLineNumbering()
Set line numbering on


setNamePool

public void setNamePool(NamePool pool)
Set the name pool used for all names in this document
Specified by:
setNamePool in interface DocumentInfo


setNodeFactory

public void setNodeFactory(NodeFactory factory)
Set the node factory that was used to build this document


setSystemId

public void setSystemId(String uri)
Set the system id of this node
Overrides:
setSystemId in interface NodeImpl


setSystemId

protected void setSystemId(int seq,
                           String uri)
Set the system id of an element in the document


setUnparsedEntity

protected void setUnparsedEntity(String name,
                                 String uri)
Set an unparsed entity URI associated with this document. For system use only, while building the document.