Class TinyDocumentImpl

  • All Implemented Interfaces:
    javax.xml.transform.Source, javax.xml.transform.SourceLocator, 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).
    • Constructor Detail

      • TinyDocumentImpl

        public TinyDocumentImpl​(TinyTree tree)
    • Method Detail

      • getTree

        public TinyTree getTree()
        Get the tree containing this node
        Overrides:
        getTree in class TinyNodeImpl
        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 interface NodeInfo
        Overrides:
        getConfiguration in class TinyNodeImpl
        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 interface javax.xml.transform.Source
        Overrides:
        setSystemId in class TinyNodeImpl
      • getSystemId

        public java.lang.String getSystemId()
        Get the system id of this root node
        Specified by:
        getSystemId in interface Location
        Specified by:
        getSystemId in interface org.xml.sax.Locator
        Specified by:
        getSystemId in interface NodeInfo
        Specified by:
        getSystemId in interface javax.xml.transform.Source
        Specified by:
        getSystemId in interface javax.xml.transform.SourceLocator
        Overrides:
        getSystemId in class TinyNodeImpl
        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 interface NodeInfo
        Overrides:
        getBaseURI in class TinyNodeImpl
        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 interface Location
        Specified by:
        getLineNumber in interface org.xml.sax.Locator
        Specified by:
        getLineNumber in interface NodeInfo
        Specified by:
        getLineNumber in interface javax.xml.transform.SourceLocator
        Overrides:
        getLineNumber in class TinyNodeImpl
        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
      • getRoot

        public NodeInfo getRoot()
        Get the root node
        Specified by:
        getRoot in interface NodeInfo
        Overrides:
        getRoot in class TinyNodeImpl
        Returns:
        the NodeInfo that is the root of the tree - not necessarily a document node
      • generateId

        public void generateId​(FastStringBuffer buffer)
        Get a character string that uniquely identifies this node
        Specified by:
        generateId in interface NodeInfo
        Overrides:
        generateId in class TinyNodeImpl
        Parameters:
        buffer - to contain an identifier based on the document number
      • atomize

        public AtomicSequence atomize()
                               throws XPathException
        Get the typed value.
        Returns:
        the typed value. This will either be a single AtomicValue or a Value whose items are atomic values.
        Throws:
        XPathException - if the node has no typed value, for example if it is an element node with element-only content
      • 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 interface NodeInfo
        Overrides:
        getSchemaType in class TinyNodeImpl
        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 in CopyOptions
        locationId - If non-null, identifies the location of the instruction that requested this copy. If zero, 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 interface NodeInfo
        Overrides:
        hashCode in class TinyNodeImpl
        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.