Package net.sf.saxon.tinytree
Class TinyDocumentImpl
- java.lang.Object
-
- net.sf.saxon.tinytree.TinyNodeImpl
-
- net.sf.saxon.tinytree.TinyParentNodeImpl
-
- net.sf.saxon.tinytree.TinyDocumentImpl
-
- All Implemented Interfaces:
javax.xml.transform.Source
,javax.xml.transform.SourceLocator
,DocumentInfo
,ExtendedNodeInfo
,FingerprintedNode
,Item
,NodeInfo
,ValueRepresentation
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).
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.tinytree.TinyNodeImpl
NODE_LETTER, nodeNr, parent, tree
-
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
Constructors Constructor Description TinyDocumentImpl(TinyTree tree)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copy(Receiver out, int whichNamespaces, boolean copyAnnotations, int locationId)
Copy this node to a given outputtervoid
generateId(FastStringBuffer buffer)
Get a character string that uniquely identifies this node(package private) AxisIterator
getAllElements(int fingerprint)
Get a list of all elements with a given name.java.lang.String
getBaseURI()
Get the base URI of this root node.Configuration
getConfiguration()
Get the configuration previously set using setConfigurationDocumentInfo
getDocumentRoot()
Get the root (document) node(package private) java.util.List
getElementList(int fingerprint)
Get a list containing all the elements with a given element nameint
getLineNumber()
Get the line number of this root node.int
getNodeKind()
Return the type of node.NodeInfo
getParent()
Find the parent node of this node.NodeInfo
getRoot()
Get the root nodejava.lang.String
getSystemId()
Get the system id of this root nodeTinyTree
getTree()
Get the tree containing this nodejava.lang.String[]
getUnparsedEntity(java.lang.String name)
Get the unparsed entity with a given nameID if there is one, or null if not.(package private) void
registerID(NodeInfo e, java.lang.String id)
Register a unique element ID.NodeInfo
selectID(java.lang.String id)
Get the element with a given ID.void
setBaseURI(java.lang.String uri)
Set the base URI of this document nodevoid
setConfiguration(Configuration config)
Set the Configuration that contains this documentvoid
setSystemId(java.lang.String uri)
Set the system id of this node(package private) void
setUnparsedEntity(java.lang.String name, java.lang.String uri, java.lang.String publicId)
Set an unparsed entity URI associated with this document.void
showSize()
-
Methods inherited from class net.sf.saxon.tinytree.TinyParentNodeImpl
getStringValue, getStringValue, getStringValueCS, hasChildNodes
-
Methods inherited from class net.sf.saxon.tinytree.TinyNodeImpl
atomize, compareOrder, equals, getAttributeValue, getColumnNumber, getDeclaredNamespaces, getDisplayName, getDocumentNumber, getFingerprint, getLocalPart, getNameCode, getNamePool, getNodeNumber, getParentNodeNr, getPrefix, getPublicId, getSequenceNumber, getTypeAnnotation, getTypedValue, getURI, hashCode, isAncestorOrSelf, isId, isIdref, isNilled, isSameNodeInfo, iterateAxis, iterateAxis, sendNamespaceDeclarations, setParentNode
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.om.Item
getStringValueCS, getTypedValue
-
Methods inherited from interface net.sf.saxon.om.NodeInfo
atomize, compareOrder, equals, getAttributeValue, getDeclaredNamespaces, getDisplayName, getDocumentNumber, getFingerprint, getLocalPart, getNameCode, getNamePool, getPrefix, getStringValue, getTypeAnnotation, getURI, hasChildNodes, hashCode, isSameNodeInfo, iterateAxis, iterateAxis, sendNamespaceDeclarations
-
-
-
-
Constructor Detail
-
TinyDocumentImpl
public TinyDocumentImpl(TinyTree tree)
-
-
Method Detail
-
getTree
public TinyTree getTree()
Get the tree containing this node
-
setConfiguration
public void setConfiguration(Configuration config)
Set the Configuration that contains this document
-
getConfiguration
public Configuration getConfiguration()
Get the configuration previously set using setConfiguration- Specified by:
getConfiguration
in interfaceNodeInfo
- Overrides:
getConfiguration
in classTinyNodeImpl
- Returns:
- the Configuration
-
setSystemId
public void setSystemId(java.lang.String uri)
Set the system id of this node- Specified by:
setSystemId
in interfacejavax.xml.transform.Source
- Overrides:
setSystemId
in classTinyNodeImpl
-
getSystemId
public java.lang.String getSystemId()
Get the system id of this root node- Specified by:
getSystemId
in interfaceNodeInfo
- Specified by:
getSystemId
in interfacejavax.xml.transform.Source
- Specified by:
getSystemId
in interfacejavax.xml.transform.SourceLocator
- Overrides:
getSystemId
in classTinyNodeImpl
- Returns:
- the System Identifier of the entity in the source document containing the node, or null if not known or not applicable.
-
setBaseURI
public void setBaseURI(java.lang.String uri)
Set the base URI of this document node
-
getBaseURI
public java.lang.String getBaseURI()
Get the base URI of this root node.- Specified by:
getBaseURI
in interfaceNodeInfo
- Overrides:
getBaseURI
in classTinyNodeImpl
- Returns:
- the base URI of the node. This may be null if the base URI is unknown.
-
getLineNumber
public int getLineNumber()
Get the line number of this root node.- Specified by:
getLineNumber
in interfaceNodeInfo
- Specified by:
getLineNumber
in interfacejavax.xml.transform.SourceLocator
- Overrides:
getLineNumber
in classTinyNodeImpl
- Returns:
- 0 always
-
getNodeKind
public final int getNodeKind()
Return the type of node.- Specified by:
getNodeKind
in interfaceNodeInfo
- Returns:
- Type.DOCUMENT (always)
- See Also:
Type
-
getParent
public NodeInfo getParent()
Find the parent node of this node.- Specified by:
getParent
in interfaceNodeInfo
- Overrides:
getParent
in classTinyNodeImpl
- Returns:
- The Node object describing the containing element or root node.
-
getRoot
public NodeInfo getRoot()
Get the root node- Specified by:
getRoot
in interfaceNodeInfo
- Overrides:
getRoot
in classTinyNodeImpl
- Returns:
- the NodeInfo that is the root of the tree - not necessarily a document node
-
getDocumentRoot
public DocumentInfo getDocumentRoot()
Get the root (document) node- Specified by:
getDocumentRoot
in interfaceNodeInfo
- Overrides:
getDocumentRoot
in classTinyNodeImpl
- Returns:
- the DocumentInfo representing the document node, or null if the root of the tree is not a document node
-
generateId
public void generateId(FastStringBuffer buffer)
Get a character string that uniquely identifies this node- Specified by:
generateId
in interfaceNodeInfo
- Overrides:
generateId
in classTinyNodeImpl
- 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.
-
getElementList
java.util.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
-
registerID
void registerID(NodeInfo e, java.lang.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 valueid
- The unique ID value. The caller is responsible for checking that this is a valid NCName.
-
selectID
public NodeInfo selectID(java.lang.String id)
Get the element with a given ID.- Specified by:
selectID
in interfaceDocumentInfo
- 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.
-
setUnparsedEntity
void setUnparsedEntity(java.lang.String name, java.lang.String uri, java.lang.String publicId)
Set an unparsed entity URI associated with this document. For system use only, while building the document.
-
getUnparsedEntity
public java.lang.String[] getUnparsedEntity(java.lang.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.- Specified by:
getUnparsedEntity
in 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
-
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 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_NAMESPACES
copyAnnotations
- 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
-
showSize
public void showSize()
-
-