net.sf.saxon.tinytree

Class TinyDocumentImpl

public final class TinyDocumentImpl extends TinyParentNodeImpl implements DocumentInfo

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

Constructor Summary
TinyDocumentImpl(TinyTree tree)
Method Summary
voidcopy(Receiver out, int whichNamespaces, boolean copyAnnotations, int locationId)
Copy this node to a given outputter
voidgenerateId(FastStringBuffer buffer)
Get a character string that uniquely identifies this node
AxisIteratorgetAllElements(int fingerprint)
Get a list of all elements with a given name.
StringgetBaseURI()
Get the base URI of this root node.
ConfigurationgetConfiguration()
Get the configuration previously set using setConfiguration
DocumentInfogetDocumentRoot()
Get the root (document) node
ListgetElementList(int fingerprint)
Get a list containing all the elements with a given element name
intgetLineNumber()
Get the line number of this root node.
intgetNodeKind()
Return the type of node.
NodeInfogetParent()
Find the parent node of this node.
NodeInfogetRoot()
Get the root node
StringgetSystemId()
Get the system id of this root node
TinyTreegetTree()
Get the tree containing this node
String[]getUnparsedEntity(String name)
Get the unparsed entity with a given nameID if there is one, or null if not.
voidregisterID(NodeInfo e, String id)
Register a unique element ID.
NodeInfoselectID(String id)
Get the element with a given ID.
voidsetConfiguration(Configuration config)
Set the Configuration that contains this document
voidsetSystemId(String uri)
Set the system id of this node
voidsetUnparsedEntity(String name, String uri, String publicId)
Set an unparsed entity URI associated with this document.
voidshowSize()

Constructor Detail

TinyDocumentImpl

public TinyDocumentImpl(TinyTree tree)

Method Detail

copy

public void copy(Receiver out, int whichNamespaces, boolean copyAnnotations, int locationId)
Copy this node to a given outputter

generateId

public void generateId(FastStringBuffer buffer)
Get a character string that uniquely identifies this node

Parameters: buffer to contain an identifier based on the document number

getAllElements

AxisIterator 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.

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.

getConfiguration

public Configuration getConfiguration()
Get the configuration previously set using setConfiguration

getDocumentRoot

public DocumentInfo getDocumentRoot()
Get the root (document) node

Returns: the DocumentInfo representing the document node, or null if the root of the tree is not a document node

getElementList

List getElementList(int fingerprint)
Get a list containing all the elements with a given element name

Parameters: fingerprint the fingerprint of the element name

Returns: list a List containing the TinyElementImpl objects

getLineNumber

public int getLineNumber()
Get the line number of this root node.

Returns: 0 always

getNodeKind

public final int getNodeKind()
Return the type of node.

Returns: Type.DOCUMENT (always)

getParent

public NodeInfo getParent()
Find the parent node of this node.

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

getRoot

public NodeInfo getRoot()
Get the root node

Returns: the NodeInfo that is the root of the tree - not necessarily a document node

getSystemId

public String getSystemId()
Get the system id of this root node

getTree

public TinyTree getTree()
Get the tree containing this node

getUnparsedEntity

public String[] getUnparsedEntity(String name)
Get the unparsed entity with a given nameID if there is one, or null if not. If the entity does not exist, return null.

Parameters: name the name of the entity

Returns: if the entity exists, return an array of two Strings, the first holding the system ID of the entity, the second holding the public

registerID

void registerID(NodeInfo e, String id)
Register a unique element ID. Fails if there is already an element with that ID.

Parameters: e The NodeInfo (always an element) having a particular unique ID value id The unique ID value. The caller is responsible for checking that this is a valid NCName.

selectID

public NodeInfo selectID(String id)
Get the element with a given ID.

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.

setConfiguration

public void setConfiguration(Configuration config)
Set the Configuration that contains this document

setSystemId

public void setSystemId(String uri)
Set the system id of this node

setUnparsedEntity

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

showSize

public void showSize()