Package net.sf.saxon.tree
Class DocumentImpl
java.lang.Object
net.sf.saxon.tree.NodeImpl
net.sf.saxon.tree.ParentNodeImpl
net.sf.saxon.tree.DocumentImpl
- All Implemented Interfaces:
Source,SourceLocator,DocumentInfo,FingerprintedNode,Item,NodeInfo,ValueRepresentation
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
sequenceFields inherited from class net.sf.saxon.tree.NodeImpl
index, NODE_LETTER, parentFields inherited from interface net.sf.saxon.om.NodeInfo
ALL_NAMESPACES, EMPTY_NAMESPACE_LIST, IS_DTD_TYPE, IS_NILLED, LOCAL_NAMESPACES, NO_NAMESPACESFields inherited from interface net.sf.saxon.om.ValueRepresentation
EMPTY_VALUE_ARRAY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCopy this node to a given outputtervoidgenerateId(FastStringBuffer buffer) Get a character string that uniquely identifies this node(package private) AxisIteratorgetAllElements(int fingerprint) Get a list of all elements with a given name fingerprintGet the base URI of this root node.Get the configuration previously set using setConfigurationGet the root (outermost) element.intGet the unique document numberGet the root (document) nodeintGet the line number of this root node.(package private) intgetLineNumber(int sequence) Get the line number for an element.Get the name pool used for the names in this documentfinal NodeInfoGet next sibling - always nullfinal intReturn the type of node.final NodeInfoGet previous sibling - always nullgetRoot()Get the root nodeGet the system id of this root node(package private) StringgetSystemId(int seq) Get the system id of an element in the documentString[]getUnparsedEntity(String name) Get the unparsed entity with a given nameGet the element with a given ID.voidsetBaseURI(String uri) Set the base URI of this document nodevoidsetConfiguration(Configuration config) Set the Configuration that contains this document(package private) voidSet the top-level element of the document (variously called the root element or the document element).(package private) voidsetLineNumber(int sequence, int line) Set the line number for an element.voidSet line numbering on(package private) voidsetSystemId(int seq, String uri) Set the system id of an element in the documentvoidsetSystemId(String uri) Set the system id of this node(package private) voidsetUnparsedEntity(String name, String uri, String publicId) Set an unparsed entity URI associated with this document.Methods inherited from class net.sf.saxon.tree.ParentNodeImpl
addChild, compact, enumerateChildren, getFirstChild, getLastChild, getNthChild, getSequenceNumber, getStringValue, getStringValueCS, hasChildNodes, useChildrenArrayMethods inherited from class net.sf.saxon.tree.NodeImpl
atomize, compareOrder, equals, getAttributeValue, getColumnNumber, getDeclaredNamespaces, getDisplayName, getFingerprint, getLocalPart, getNameCode, getNextInDocument, getParent, getPrefix, getPreviousInDocument, getPublicId, getTypeAnnotation, getTypedValue, getURI, hashCode, isSameNodeInfo, iterateAxis, iterateAxis, sendNamespaceDeclarationsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.sf.saxon.om.Item
getStringValueCS, getTypedValueMethods inherited from interface net.sf.saxon.om.NodeInfo
atomize, compareOrder, equals, getAttributeValue, getDeclaredNamespaces, getDisplayName, getFingerprint, getLocalPart, getNameCode, getParent, getPrefix, getStringValue, getTypeAnnotation, getURI, hasChildNodes, hashCode, isSameNodeInfo, iterateAxis, iterateAxis, sendNamespaceDeclarations
-
Constructor Details
-
DocumentImpl
public DocumentImpl()
-
-
Method Details
-
setConfiguration
Set the Configuration that contains this document -
getConfiguration
Get the configuration previously set using setConfiguration- Specified by:
getConfigurationin interfaceNodeInfo- Overrides:
getConfigurationin classNodeImpl- Returns:
- the Configuration
-
getNamePool
Get the name pool used for the names in this document- Specified by:
getNamePoolin interfaceNodeInfo- Overrides:
getNamePoolin classNodeImpl- Returns:
- the namepool
-
getDocumentNumber
public int getDocumentNumber()Get the unique document number- Specified by:
getDocumentNumberin interfaceNodeInfo- Overrides:
getDocumentNumberin classNodeImpl
-
setDocumentElement
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
-
setSystemId
Set the system id of this node- Specified by:
setSystemIdin interfaceSource- Overrides:
setSystemIdin classNodeImpl
-
getSystemId
Get the system id of this root node- Specified by:
getSystemIdin interfaceNodeInfo- Specified by:
getSystemIdin interfaceSource- Specified by:
getSystemIdin interfaceSourceLocator- Overrides:
getSystemIdin classNodeImpl- Returns:
- the System Identifier of the entity in the source document containing the node, or null if not known or not applicable.
-
setBaseURI
Set the base URI of this document node -
getBaseURI
Get the base URI of this root node.- Specified by:
getBaseURIin interfaceNodeInfo- Overrides:
getBaseURIin classNodeImpl- Returns:
- the base URI of the node. This may be null if the base URI is unknown.
-
setSystemId
Set the system id of an element in the document -
getSystemId
Get the system id of an element in the document -
setLineNumbering
public void setLineNumbering()Set line numbering on -
setLineNumber
void setLineNumber(int sequence, int line) Set the line number for an element. Ignored if line numbering is off. -
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.- Specified by:
getLineNumberin interfaceNodeInfo- Specified by:
getLineNumberin interfaceSourceLocator- Overrides:
getLineNumberin classNodeImpl- Returns:
- 0 always
-
getNodeKind
public final int getNodeKind()Return the type of node.- Specified by:
getNodeKindin interfaceNodeInfo- Returns:
- Type.DOCUMENT (always)
- See Also:
-
getNextSibling
Get next sibling - always null- Overrides:
getNextSiblingin classNodeImpl- Returns:
- null
-
getPreviousSibling
Get previous sibling - always null- Overrides:
getPreviousSiblingin classNodeImpl- Returns:
- null
-
getDocumentElement
Get the root (outermost) element.- Returns:
- the Element node for the outermost element of the document.
-
getRoot
Get the root node -
getDocumentRoot
Get the root (document) node- Specified by:
getDocumentRootin interfaceNodeInfo- Overrides:
getDocumentRootin classNodeImpl- Returns:
- the DocumentInfo representing this document
-
generateId
Get a character string that uniquely identifies this node- Specified by:
generateIdin interfaceNodeInfo- Overrides:
generateIdin classNodeImpl- Parameters:
buffer- a buffer into which will be placed a string based on the document number
-
getAllElements
Get a list of all elements with a given name fingerprint -
selectID
Get the element with a given ID.- Specified by:
selectIDin interfaceDocumentInfo- 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.
-
setUnparsedEntity
Set an unparsed entity URI associated with this document. For system use only, while building the document. -
getUnparsedEntity
Get the unparsed entity with a given name- Specified by:
getUnparsedEntityin interfaceDocumentInfo- 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
-
copy
public void copy(Receiver out, int whichNamespaces, boolean copyAnnotations, int locationId) throws XPathException Copy this node to a given outputter- Specified by:
copyin interfaceNodeInfo- Parameters:
out- the Receiver to which the node should be copiedwhichNamespaces- in the case of an element, controls which namespace nodes should be copied. Values areNodeInfo.NO_NAMESPACES,NodeInfo.LOCAL_NAMESPACES,NodeInfo.ALL_NAMESPACEScopyAnnotations- indicates whether the type annotations of element and attribute nodes should be copiedlocationId- If non-zero, identifies the location of the instruction that requested this copy. If zero, indicates that the location information for the original node is to be copied; in this case the Receiver must be a LocationCopier- Throws:
XPathException
-