com.icl.saxon.tinytree

Class TinyDocumentImpl

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

public final class TinyDocumentImpl
extends com.icl.saxon.tinytree.TinyParentNodeImpl
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

protected int[]
attCode
protected int[]
attParent
protected String[]
attValue
protected char[]
charBuffer
protected int
charBufferLength
protected StringBuffer
commentBuffer
protected short[]
depth
protected int
lastLevelOneNode
protected int[]
length
protected int[]
nameCode
protected int[]
namespaceCode
protected int[]
namespaceParent
protected int[]
next
protected byte[]
nodeType
protected int
numberOfAttributes
protected int
numberOfNamespaces
protected int
numberOfNodes
protected int[]
offset
protected int[]
prior

Fields inherited from class com.icl.saxon.tinytree.TinyNodeImpl

document, nodeNr, 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

TinyDocumentImpl()

Method Summary

protected void
addAttribute(int parent0, int code0, String type0, String value0)
protected void
addNamespace(int parent0, int nscode0)
protected void
addNode(short type0, int depth0, int offset0, int length0, int nameCode0)
protected void
appendChars(char[] chars, int start, int length)
void
copy(Outputter out)
Copy this node to a given outputter
void
diagnosticDump()
Produce diagnostic print of main tree arrays
protected void
ensureAttributeCapacity()
protected void
ensureNamespaceCapacity()
protected void
ensureNodeCapacity()
protected void
ensurePriorIndex()
On demand, make an index for quick access to preceding-sibling nodes
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.
protected com.icl.saxon.tinytree.TinyAttributeImpl
getAttributeNode(int nr)
Make a (transient) attribute node from the array of attributes
String
getBaseURI()
Get the base URI of this root node.
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
protected com.icl.saxon.tinytree.TinyNamespaceImpl
getNamespaceNode(int nr)
Make a (transient) namespace node from the array of namespace declarations
com.icl.saxon.tinytree.TinyNodeImpl
getNode(int nr)
short
getNodeType()
Return the type of node.
NodeInfo
getParent()
Find the parent node of this node.
long
getSequenceNumber()
Get the node sequence number (in document order).
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
protected boolean
isUsingNamespaces()
determine whether this document uses namespaces
NodeInfo
selectID(String id)
Get the element with a given ID.
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
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.
protected void
truncate(int nodes)
Truncate the tree: used in preview mode to delete an element after it has been processed

Methods inherited from class com.icl.saxon.tinytree.TinyParentNodeImpl

copyStringValue, getStringValue, hasChildNodes

Methods inherited from class com.icl.saxon.tinytree.TinyNodeImpl

compareOrder, generateId, getAttributeValue, getAttributeValue, getBaseURI, getDisplayName, getDocumentRoot, getEnumeration, getFingerprint, getLineNumber, getLocalName, getNameCode, getOriginatingNode, getParent, getPrefix, getSequenceNumber, getSystemId, getURI, hasAttributes, hasChildNodes, isSameNode, outputNamespaceNodes, setLineNumber, setParentNode, 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

Field Details

attCode

protected int[] attCode


attParent

protected int[] attParent


attValue

protected String[] attValue


charBuffer

protected char[] charBuffer


charBufferLength

protected int charBufferLength


commentBuffer

protected StringBuffer commentBuffer


depth

protected short[] depth


lastLevelOneNode

protected int lastLevelOneNode


length

protected int[] length


nameCode

protected int[] nameCode


namespaceCode

protected int[] namespaceCode


namespaceParent

protected int[] namespaceParent


next

protected int[] next


nodeType

protected byte[] nodeType


numberOfAttributes

protected int numberOfAttributes


numberOfNamespaces

protected int numberOfNamespaces


numberOfNodes

protected int numberOfNodes


offset

protected int[] offset


prior

protected int[] prior

Constructor Details

TinyDocumentImpl

public TinyDocumentImpl()

Method Details

addAttribute

protected void addAttribute(int parent0,
                            int code0,
                            String type0,
                            String value0)


addNamespace

protected void addNamespace(int parent0,
                            int nscode0)


addNode

protected void addNode(short type0,
                       int depth0,
                       int offset0,
                       int length0,
                       int nameCode0)


appendChars

protected void appendChars(char[] chars,
                           int start,
                           int length)


copy

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


diagnosticDump

public void diagnosticDump()
Produce diagnostic print of main tree arrays


ensureAttributeCapacity

protected void ensureAttributeCapacity()


ensureNamespaceCapacity

protected void ensureNamespaceCapacity()


ensureNodeCapacity

protected void ensureNodeCapacity()


ensurePriorIndex

protected void ensurePriorIndex()
On demand, make an index for quick access to preceding-sibling nodes


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 com.icl.saxon.tinytree.TinyNodeImpl

Returns:
the empty string


getAllElements

protected AxisEnumeration getAllElements(int fingerprint)
Get a list of all elements with a given name. This is implemented as a memo function: the first time it is called for a particular element type, it remembers the result for next time.


getAttributeNode

protected com.icl.saxon.tinytree.TinyAttributeImpl getAttributeNode(int nr)
Make a (transient) attribute node from the array of attributes


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 com.icl.saxon.tinytree.TinyNodeImpl


getDocumentRoot

public DocumentInfo getDocumentRoot()
Get the root (document) node
Specified by:
getDocumentRoot in interface NodeInfo
Overrides:
getDocumentRoot in interface com.icl.saxon.tinytree.TinyNodeImpl

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

Returns:
The index, if one has been built, in the form of a Hashtable that maps the key value to a set 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 com.icl.saxon.tinytree.TinyNodeImpl

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


getNamespaceNode

protected com.icl.saxon.tinytree.TinyNamespaceImpl getNamespaceNode(int nr)
Make a (transient) namespace node from the array of namespace declarations


getNode

public com.icl.saxon.tinytree.TinyNodeImpl getNode(int nr)


getNodeType

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

Returns:
NodeInfo.ROOT (always)


getParent

public NodeInfo getParent()
Find the parent node of this node.
Specified by:
getParent in interface NodeInfo
Overrides:
getParent in interface com.icl.saxon.tinytree.TinyNodeImpl

Returns:
The Node object describing the containing element or root node.


getSequenceNumber

public long getSequenceNumber()
Get the node sequence number (in document order). Sequence numbers are monotonic but not consecutive.
Overrides:
getSequenceNumber in interface com.icl.saxon.tinytree.TinyNodeImpl


getSystemId

public String getSystemId()
Get the system id of this root node
Specified by:
getSystemId in interface NodeInfo
Overrides:
getSystemId in interface com.icl.saxon.tinytree.TinyNodeImpl


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


isUsingNamespaces

protected boolean isUsingNamespaces()
determine whether this document uses namespaces


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 (always an Element) for the given ID if one has been registered, otherwise null.


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 set 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


setSystemId

public void setSystemId(String uri)
Set the system id of this node
Overrides:
setSystemId in interface com.icl.saxon.tinytree.TinyNodeImpl


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.


truncate

protected void truncate(int nodes)
Truncate the tree: used in preview mode to delete an element after it has been processed