Package net.sf.saxon.tree.tiny
Class TinyDocumentImpl
- java.lang.Object
-
- net.sf.saxon.tree.tiny.TinyNodeImpl
-
- net.sf.saxon.tree.tiny.TinyParentNodeImpl
-
- net.sf.saxon.tree.tiny.TinyDocumentImpl
-
- All Implemented Interfaces:
javax.xml.transform.Source
,javax.xml.transform.SourceLocator
,ActiveSource
,GroundedValue
,Item
,NodeInfo
,Sequence
,Location
,org.xml.sax.Locator
public final class TinyDocumentImpl extends TinyParentNodeImpl
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.tree.tiny.TinyNodeImpl
NODE_LETTER, nodeNr, parent, tree
-
-
Constructor Summary
Constructors Constructor Description TinyDocumentImpl(TinyTree tree)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AtomicSequence
atomize()
Get the typed value.void
copy(Receiver out, int copyOptions, Location locationId)
Copy this node to a given outputtervoid
generateId(java.lang.StringBuilder buffer)
Get a character string that uniquely identifies this nodejava.lang.String
getBaseURI()
Get the base URI of this root node.Configuration
getConfiguration()
Get the configuration previously set using setConfigurationint
getLineNumber()
Get the line number of this root node.int
getNodeKind()
Return the type of node.TinyNodeImpl
getParent()
Find the parent node of this node.NodeInfo
getRoot()
Get the root nodeNodeInfo
getRootNode()
Get the NodeInfo object representing the document node at the root of the treeSchemaType
getSchemaType()
Get the type annotation of this node, if any.java.lang.String
getSystemId()
Get the system id of this root nodeTinyTree
getTree()
Get the tree containing this nodeint
hashCode()
The hashCode() method obeys the contract for hashCode(): that is, if two objects are equal (represent the same node) then they must have the same hashCode()boolean
isTyped()
Ask whether the document contains any nodes whose type annotation is anything other than UNTYPEDvoid
setBaseURI(java.lang.String uri)
Set the base URI of this document nodevoid
setSystemId(java.lang.String uri)
Set the system id of this nodevoid
showSize()
-
Methods inherited from class net.sf.saxon.tree.tiny.TinyParentNodeImpl
getStringValue, getUnicodeStringValue, hasChildNodes
-
Methods inherited from class net.sf.saxon.tree.tiny.TinyNodeImpl
compareOrder, equals, getAllNamespaces, getAttributeValue, getColumnNumber, getDeclaredNamespaces, getDisplayName, getFingerprint, getGenre, getLocalPart, getNamePool, getNamespaceUri, getNodeNumber, getParentNodeNr, getPrefix, getSequenceNumber, getTreeInfo, hasFingerprint, hasURI, head, isAncestorOrSelf, isId, isIdref, isNilled, isSameNodeInfo, isStreamed, iterateAxis, iterateAxis, saveLocation, 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.GroundedValue
asIterable, concatenate, containsNode, effectiveBooleanValue, materialize
-
Methods inherited from interface net.sf.saxon.om.Item
getLength, getStringValue, itemAt, iterate, reduce, subsequence
-
Methods inherited from interface net.sf.saxon.om.NodeInfo
asActiveSource, attributes, children, children, deliver, getAttributeValue, getPublicId, getURI, toShortString
-
Methods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
-
-
-
Constructor Detail
-
TinyDocumentImpl
public TinyDocumentImpl(TinyTree tree)
-
-
Method Detail
-
getTree
public TinyTree getTree()
Get the tree containing this node- Overrides:
getTree
in classTinyNodeImpl
- Returns:
- the TinyTree. Note that this may also contain other unrelated trees
-
getRootNode
public NodeInfo getRootNode()
Get the NodeInfo object representing the document node at the root of the tree- Returns:
- the document node
-
getConfiguration
public Configuration getConfiguration()
Get the configuration previously set using setConfiguration- Specified by:
getConfiguration
in interfaceNodeInfo
- Overrides:
getConfiguration
in classTinyNodeImpl
- Returns:
- the Configuration to which the tree belongs. The default implementation invokes
getTreeInfo().getConfiguration()
.
-
setSystemId
public void setSystemId(java.lang.String uri)
Set the system id of this node- Specified by:
setSystemId
in interfaceNodeInfo
- 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 interfaceLocation
- Specified by:
getSystemId
in interfaceorg.xml.sax.Locator
- 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- Parameters:
uri
- the base URI
-
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, including the case where the node has no parent.
-
getLineNumber
public int getLineNumber()
Get the line number of this root node.- Specified by:
getLineNumber
in interfaceLocation
- Specified by:
getLineNumber
in interfaceorg.xml.sax.Locator
- Specified by:
getLineNumber
in interfaceNodeInfo
- Specified by:
getLineNumber
in interfacejavax.xml.transform.SourceLocator
- Overrides:
getLineNumber
in classTinyNodeImpl
- Returns:
- 0 always
-
isTyped
public boolean isTyped()
Ask whether the document contains any nodes whose type annotation is anything other than UNTYPED- Returns:
- true if the document contains elements whose type is other than UNTYPED
-
getNodeKind
public final int getNodeKind()
Return the type of node.- Returns:
- Type.DOCUMENT (always)
- See Also:
Type
-
getParent
public TinyNodeImpl 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
-
generateId
public void generateId(java.lang.StringBuilder 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
-
atomize
public AtomicSequence atomize()
Get the typed value.- Returns:
- the typed value. This will either be a single AtomicValue or a Value whose items are atomic values.
-
getSchemaType
public SchemaType getSchemaType()
Get the type annotation of this node, if any. The type annotation is represented as SchemaType object.Types derived from a DTD are not reflected in the result of this method.
- Specified by:
getSchemaType
in interfaceNodeInfo
- Overrides:
getSchemaType
in classTinyNodeImpl
- Returns:
- For element and attribute nodes: the type annotation derived from schema validation (defaulting to xs:untyped and xs:untypedAtomic in the absence of schema validation). For comments, text nodes, processing instructions, and namespaces: null. For document nodes, either xs:untyped if the document has not been validated, or xs:anyType if it has.
- Since:
- 9.4
-
copy
public void copy(Receiver out, int copyOptions, Location locationId) throws XPathException
Copy this node to a given outputter- Parameters:
out
- the Receiver to which the node should be copied. It is the caller's responsibility to ensure that this Receiver is open before the method is called (or that it is self-opening), and that it is closed after use.copyOptions
- a selection of the options defined inCopyOptions
locationId
- If non-null, identifies the location of the instruction that requested this copy. If null, indicates that the location information is not available- Throws:
XPathException
- if any downstream error occurs
-
showSize
public void showSize()
-
hashCode
public int hashCode()
The hashCode() method obeys the contract for hashCode(): that is, if two objects are equal (represent the same node) then they must have the same hashCode()- Specified by:
hashCode
in interfaceNodeInfo
- Overrides:
hashCode
in classTinyNodeImpl
- Since:
- 8.7 Previously, the effect of the equals() and hashCode() methods was not defined. Callers should therefore be aware that third party implementations of the NodeInfo interface may not implement the correct semantics.
-
-