net.sf.saxon.tree

Class DocumentImpl

public final class DocumentImpl extends ParentNodeImpl implements DocumentInfo

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

Author: Michael H. Kay

Constructor Summary
DocumentImpl()
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 fingerprint
StringgetBaseURI()
Get the base URI of this root node.
ConfigurationgetConfiguration()
Get the configuration previously set using setConfiguration
ElementImplgetDocumentElement()
Get the root (outermost) element.
intgetDocumentNumber()
Get the unique document number
DocumentInfogetDocumentRoot()
Get the root (document) node
intgetLineNumber(int sequence)
Get the line number for an element.
intgetLineNumber()
Get the line number of this root node.
NamePoolgetNamePool()
Get the name pool used for the names in this document
NodeInfogetNextSibling()
Get next sibling - always null
intgetNodeKind()
Return the type of node.
NodeInfogetPreviousSibling()
Get previous sibling - always null
NodeInfogetRoot()
Get the root node
StringgetSystemId()
Get the system id of this root node
StringgetSystemId(int seq)
Get the system id of an element in the document
String[]getUnparsedEntity(String name)
Get the unparsed entity with a given name
NodeInfoselectID(String id)
Get the element with a given ID.
voidsetConfiguration(Configuration config)
Set the Configuration that contains this document
voidsetDocumentElement(ElementImpl e)
Set the top-level element of the document (variously called the root element or the document element).
voidsetLineNumber(int sequence, int line)
Set the line number for an element.
voidsetLineNumbering()
Set line numbering on
voidsetSystemId(String uri)
Set the system id of this node
voidsetSystemId(int seq, String uri)
Set the system id of an element in the document
voidsetUnparsedEntity(String name, String uri, String publicId)
Set an unparsed entity URI associated with this document.

Constructor Detail

DocumentImpl

public DocumentImpl()

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 a buffer into which will be placed a string based on the document number

getAllElements

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

getConfiguration

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

getDocumentElement

public ElementImpl getDocumentElement()
Get the root (outermost) element.

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

getDocumentNumber

public int getDocumentNumber()
Get the unique document number

getDocumentRoot

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

Returns: the DocumentInfo representing this document

getLineNumber

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

getLineNumber

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

Returns: 0 always

getNamePool

public NamePool getNamePool()
Get the name pool used for the names in this document

getNextSibling

public final NodeInfo getNextSibling()
Get next sibling - always null

Returns: null

getNodeKind

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

Returns: Type.DOCUMENT (always)

getPreviousSibling

public final NodeInfo getPreviousSibling()
Get previous sibling - always null

Returns: null

getRoot

public NodeInfo getRoot()
Get the root node

Returns: the NodeInfo representing the root of this tree

getSystemId

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

getSystemId

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

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 ID if there is one, or null if not. If the entity does not exist, return null. * @return 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.

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.

setConfiguration

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

setDocumentElement

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

setLineNumber

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

setSystemId

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

setSystemId

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

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.