net.sf.saxon.tree

Class DocumentImpl

Implemented Interfaces:
DocumentInfo, FingerprintedNode, Item, NodeInfo, Source, NodeInfo, PullEvent, SourceLocator, ValueRepresentation

public final class DocumentImpl
extends net.sf.saxon.tree.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

Field Summary

Fields inherited from class net.sf.saxon.tree.ParentNodeImpl

sequence

Fields inherited from class net.sf.saxon.tree.NodeImpl

NODE_LETTER, index, parent

Fields inherited from interface net.sf.saxon.om.NodeInfo

ALL_NAMESPACES, EMPTY_NAMESPACE_LIST, IS_DTD_TYPE, IS_NILLED, LOCAL_NAMESPACES, NO_NAMESPACES

Fields inherited from interface net.sf.saxon.om.NodeInfo

ALL_NAMESPACES, EMPTY_NAMESPACE_LIST, IS_DTD_TYPE, IS_NILLED, LOCAL_NAMESPACES, NO_NAMESPACES

Fields inherited from interface net.sf.saxon.om.ValueRepresentation

EMPTY_VALUE_ARRAY

Constructor Summary

DocumentImpl()

Method Summary

void
copy(Receiver out, int whichNamespaces, boolean copyAnnotations, int locationId)
Copy this node to a given outputter
void
generateId(FastStringBuffer buffer)
Get a character string that uniquely identifies this node
String
getBaseURI()
Get the base URI of this root node.
Configuration
getConfiguration()
Get the configuration previously set using setConfiguration
ElementImpl
getDocumentElement()
Get the root (outermost) element.
int
getDocumentNumber()
Get the unique document number
DocumentInfo
getDocumentRoot()
Get the root (document) node
int
getLineNumber()
Get the line number of this root node.
NamePool
getNamePool()
Get the name pool used for the names in this document
NodeInfo
getNextSibling()
Get next sibling - always null
int
getNodeKind()
Return the type of node.
NodeInfo
getPreviousSibling()
Get previous sibling - always null
NodeInfo
getRoot()
Get the root node
String
getSystemId()
Get the system id of this root node
String[]
getUnparsedEntity(String name)
Get the unparsed entity with a given name
NodeInfo
selectID(String id)
Get the element with a given ID.
void
setBaseURI(String uri)
Set the base URI of this document node
void
setConfiguration(Configuration config)
Set the Configuration that contains this document
void
setLineNumbering()
Set line numbering on
void
setSystemId(String uri)
Set the system id of this node

Methods inherited from class net.sf.saxon.tree.ParentNodeImpl

addChild, compact, enumerateChildren, getFirstChild, getLastChild, getNthChild, getSequenceNumber, getStringValue, getStringValueCS, hasChildNodes, useChildrenArray

Methods inherited from class net.sf.saxon.tree.NodeImpl

atomize, compareOrder, equals, generateId, getAttributeValue, getBaseURI, getColumnNumber, getConfiguration, getDeclaredNamespaces, getDisplayName, getDocumentNumber, getDocumentRoot, getFingerprint, getFirstChild, getLastChild, getLineNumber, getLocalPart, getNameCode, getNamePool, getNextInDocument, getNextSibling, getParent, getPrefix, getPreviousInDocument, getPreviousSibling, getPublicId, getRoot, getSequenceNumber, getStringValueCS, getSystemId, getTypeAnnotation, getTypedValue, getURI, hasChildNodes, hashCode, isSameNodeInfo, iterateAxis, iterateAxis, setSystemId

Constructor Details

DocumentImpl

public DocumentImpl()

Method Details

copy

public void copy(Receiver out,
                 int whichNamespaces,
                 boolean copyAnnotations,
                 int locationId)
            throws XPathException
Copy this node to a given outputter
Specified by:
copy in interface NodeInfo

generateId

public void generateId(FastStringBuffer buffer)
Get a character string that uniquely identifies this node
Specified by:
generateId in interface NodeInfo
Overrides:
generateId in interface NodeImpl
Parameters:
buffer - a buffer into which will be placed a string based on the document number

getBaseURI

public String getBaseURI()
Get the base URI of this root node.
Specified by:
getBaseURI in interface NodeInfo
Overrides:
getBaseURI in interface NodeImpl

getConfiguration

public Configuration getConfiguration()
Get the configuration previously set using setConfiguration
Specified by:
getConfiguration in interface NodeInfo
Overrides:
getConfiguration in interface NodeImpl

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
Specified by:
getDocumentNumber in interface NodeInfo
Overrides:
getDocumentNumber in interface NodeImpl

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

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

getNamePool

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

getNextSibling

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

getNodeKind

public final int getNodeKind()
Return the type of node.
Specified by:
getNodeKind in interface NodeInfo
Returns:
Type.DOCUMENT (always)

getPreviousSibling

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

getRoot

public NodeInfo getRoot()
Get the root node
Specified by:
getRoot in interface NodeInfo
Overrides:
getRoot in interface NodeImpl
Returns:
the NodeInfo representing the root of this tree

getSystemId

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

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

setBaseURI

public void setBaseURI(String uri)
Set the base URI of this document node

setConfiguration

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

setLineNumbering

public void setLineNumbering()
Set line numbering on

setSystemId

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