Class DominoTree

  • All Implemented Interfaces:
    javax.xml.transform.Source, TreeInfo, NodeVectorTree

    public final class DominoTree
    extends GenericTreeInfo
    implements NodeVectorTree
    An adaptation of the TinyTree structure, used to index a DOM. The data structure for a DOMINO tree consists of a set of arrays, each containing one entry for every node other than attributes and namespaces. These arrays contain for each node: the node kind, the depth of the node in the tree, an integer fingerprint of the node name, various bit-significant flags, and a reference to the node in the DOM tree being indexed. All navigation is done using the DOMINO index structures, but the DOM nodes are referenced to get the actual data values, and a few other things like prefixes. Attributes are accessed entirely from the DOM structure.
    Since:
    9.8
    • Field Detail

      • numberOfNodes

        protected int numberOfNodes
      • nodeKind

        public byte[] nodeKind
      • depth

        protected short[] depth
      • next

        protected int[] next
      • nameCode

        protected int[] nameCode
      • prior

        protected int[] prior
      • domNodes

        protected org.w3c.dom.Node[] domNodes
    • Method Detail

      • makeTree

        public static DominoTree makeTree​(org.w3c.dom.Document doc,
                                          Configuration config,
                                          java.lang.String systemId)
                                   throws XPathException
        Factory method to construct a Domino tree referencing a supplied DOM document
        Parameters:
        doc - the DOM document
        config - the Saxon configuration
        systemId - the system id (base URI) of the document
        Returns:
        the Domino tree object
        Throws:
        XPathException - in the event of failure (for example, if there is no Saxon-EE license)
      • isTyped

        public boolean isTyped()
        Description copied from interface: NodeVectorTree
        Ask whether the tree contains non-trivial type information (from schema validation)
        Specified by:
        isTyped in interface NodeVectorTree
        Specified by:
        isTyped in interface TreeInfo
        Returns:
        true if type information is present
      • setCurrentNode

        public void setCurrentNode​(org.w3c.dom.Node node)
      • getDomNode

        public org.w3c.dom.Node getDomNode​(int nodeNr)
      • getUnparsedEntityNames

        public java.util.Iterator<java.lang.String> getUnparsedEntityNames()
        Get the list of unparsed entities defined in this document
        Specified by:
        getUnparsedEntityNames in interface TreeInfo
        Overrides:
        getUnparsedEntityNames in class GenericTreeInfo
        Returns:
        an Iterator, whose items are of type String, containing the names of all unparsed entities defined in this document. If there are no unparsed entities or if the information is not available then an empty iterator is returned
      • getUnparsedEntity

        public java.lang.String[] getUnparsedEntity​(java.lang.String name)
        Get the unparsed entity with a given name
        Specified by:
        getUnparsedEntity in interface TreeInfo
        Overrides:
        getUnparsedEntity in class GenericTreeInfo
        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 (as an absolute URI if possible), the second holding the public ID if there is one, or null if not. If the entity does not exist, the method returns null. Applications should be written on the assumption that this array may be extended in the future to provide additional information.
      • getSchemaType

        public SchemaType getSchemaType​(int nodeNr)
        Get the type annotation of a node. Applies only to document, element, text, processing instruction, and comment nodes.
        Parameters:
        nodeNr - the node whose type annotation is required
        Returns:
        the fingerprint of the type annotation for elements and attributes, otherwise undefined.
      • getNodeKind

        public int getNodeKind​(int nodeNr)
        Get the node kind of a given node, which must be a document, element, text, comment, or processing instruction node
        Specified by:
        getNodeKind in interface NodeVectorTree
        Parameters:
        nodeNr - the node number
        Returns:
        the node kind
      • getFingerprint

        public int getFingerprint​(int nodeNr)
        Get the fingerprint for a given node, which must be a document, element, text, comment, or processing instruction node
        Specified by:
        getFingerprint in interface NodeVectorTree
        Parameters:
        nodeNr - the node number
        Returns:
        the fingerprint, identifying the node name in the name pool
      • getNode

        public final DominoNode getNode​(int nr)
        Get the node at a given position in the tree
        Specified by:
        getNode in interface NodeVectorTree
        Parameters:
        nr - the node number
        Returns:
        the node at the given position
      • selectID

        public DominoNode selectID​(java.lang.String id,
                                   boolean getParent)
        Get the element with a given ID.
        Specified by:
        selectID in interface TreeInfo
        Overrides:
        selectID in class GenericTreeInfo
        Parameters:
        id - The unique ID of the required element, previously registered using registerID()
        getParent - true if the required element is the parent of the element of type ID
        Returns:
        The NodeInfo (always an Element) for the given ID if one has been registered, otherwise null.
      • getNamePool

        public NamePool getNamePool()
        Get the NamePool used to map element and attribute names to fingerprints
        Specified by:
        getNamePool in interface NodeVectorTree
        Returns:
        the name pool
      • getNumberOfNodes

        public int getNumberOfNodes()
        Get the number of nodes in the tree, excluding attributes and namespace nodes
        Returns:
        the number of nodes.
      • getAllElements

        public 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.
        Parameters:
        fingerprint - the fingerprint identifying the required element name
        Returns:
        an iterator over all elements with this name