Class GenericTreeInfo

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected NodeInfo root  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Configuration getConfiguration()
      Get the Configuration to which this tree belongs
      long getDocumentNumber()
      Get the document number, which identifies this tree uniquely within a Configuration
      java.lang.String getPublicId()
      Get the Public ID of the entity containing the node.
      NodeInfo getRootNode()
      Get the NodeInfo object representing the root of the tree (not necessarily a document node)
      SpaceStrippingRule getSpaceStrippingRule()
      Get details of space stripping action that was applied to this document during construction.
      java.lang.String getSystemId()
      Get the systemId of the document node
      java.lang.String[] getUnparsedEntity​(java.lang.String name)
      Get the unparsed entity with a given name
      java.util.Iterator<java.lang.String> getUnparsedEntityNames()
      Get the list of unparsed entities defined in this document
      java.lang.Object getUserData​(java.lang.String key)
      Get user data held in the tree.
      boolean isStreamed()  
      NodeInfo selectID​(java.lang.String id, boolean getParent)
      Get the element with a given ID, if any
      void setConfiguration​(Configuration config)
      Set the configuration (containing the name pool used for all names in this tree)
      void setDocumentNumber​(long documentNumber)
      Set the document number, which identifies this tree uniquely within a Configuration
      void setRootNode​(NodeInfo root)
      Set the root node of the tree
      void setSpaceStrippingRule​(SpaceStrippingRule rule)
      Set details of space stripping action that was applied to this document during construction.
      void setSystemId​(java.lang.String systemId)
      Set the systemId of the document node (for most implementations, this is likely to be the systemId of the entire tree)
      void setUserData​(java.lang.String key, java.lang.Object value)
      Set user data on the tree.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface javax.xml.transform.Source

        isEmpty
    • Constructor Detail

      • GenericTreeInfo

        public GenericTreeInfo​(Configuration config)
        Create the TreeInfo
        Parameters:
        config - the Saxon Configuration
      • GenericTreeInfo

        public GenericTreeInfo​(Configuration config,
                               NodeInfo root)
        Create the TreeInfo
        Parameters:
        config - the Saxon Configuration
        root - the root node
        Throws:
        java.lang.IllegalArgumentException - if the supplied node is not parentless
    • Method Detail

      • setConfiguration

        public void setConfiguration​(Configuration config)
        Set the configuration (containing the name pool used for all names in this tree)
        Parameters:
        config - the configuration
      • getConfiguration

        public Configuration getConfiguration()
        Get the Configuration to which this tree belongs
        Specified by:
        getConfiguration in interface TreeInfo
        Returns:
        the configuration
      • setRootNode

        public void setRootNode​(NodeInfo root)
        Set the root node of the tree
        Parameters:
        root - the root node (not necessarily a document node)
        Throws:
        java.lang.IllegalArgumentException - if the supplied node is not parentless
      • getRootNode

        public NodeInfo getRootNode()
        Get the NodeInfo object representing the root of the tree (not necessarily a document node)
        Specified by:
        getRootNode in interface TreeInfo
        Returns:
        the root node
      • setSystemId

        public void setSystemId​(java.lang.String systemId)
        Set the systemId of the document node (for most implementations, this is likely to be the systemId of the entire tree)
        Specified by:
        setSystemId in interface javax.xml.transform.Source
        Parameters:
        systemId - the system ID
      • getSystemId

        public java.lang.String getSystemId()
        Get the systemId of the document node
        Specified by:
        getSystemId in interface javax.xml.transform.Source
        Returns:
        the system ID
      • getPublicId

        public java.lang.String getPublicId()
        Get the Public ID of the entity containing the node.
        Returns:
        null (always)
        Since:
        9.7
      • getDocumentNumber

        public long getDocumentNumber()
        Get the document number, which identifies this tree uniquely within a Configuration
        Specified by:
        getDocumentNumber in interface TreeInfo
        Returns:
        the document number
      • setDocumentNumber

        public void setDocumentNumber​(long documentNumber)
        Set the document number, which identifies this tree uniquely within a Configuration
        Parameters:
        documentNumber - the document number allocated to this tree
      • selectID

        public NodeInfo selectID​(java.lang.String id,
                                 boolean getParent)
        Get the element with a given ID, if any
        Specified by:
        selectID in interface TreeInfo
        Parameters:
        id - the required ID value
        getParent - true if running the element-with-id() function rather than the id() function; the difference is that in the case of an element of type xs:ID, the parent of the element should be returned, not the element itself.
        Returns:
        the element with the given ID, or null if there is no such ID present (or if the parser has not notified attributes as being of type ID)
        Since:
        8.4. Second argument added in 9.2.
      • 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
        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
        Since:
        9.1
      • getUnparsedEntity

        public java.lang.String[] getUnparsedEntity​(java.lang.String name)
        Get the unparsed entity with a given name
        Specified by:
        getUnparsedEntity in interface TreeInfo
        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.
        Since:
        8.4
      • setSpaceStrippingRule

        public void setSpaceStrippingRule​(SpaceStrippingRule rule)
        Set details of space stripping action that was applied to this document during construction. This ensures that space stripping is not applied twice to the same document.
        Specified by:
        setSpaceStrippingRule in interface TreeInfo
        Parameters:
        rule - details of the space stripping rules that have been applied to this document during its construction.
        Since:
        9.9
      • getSpaceStrippingRule

        public SpaceStrippingRule getSpaceStrippingRule()
        Get details of space stripping action that was applied to this document during construction. This ensures that space stripping is not applied twice to the same document.
        Specified by:
        getSpaceStrippingRule in interface TreeInfo
        Returns:
        details of the space stripping rules that have been applied to this document during its construction. By default, returns NoElementsSpaceStrippingRule, indicating that no space stripping has been applied
        Since:
        9.9
      • setUserData

        public void setUserData​(java.lang.String key,
                                java.lang.Object value)
        Set user data on the tree. The user data can be retrieved subsequently using getUserData(java.lang.String)
        Specified by:
        setUserData in interface TreeInfo
        Parameters:
        key - A string giving the name of the property to be set. Clients are responsible for choosing a key that is likely to be unique. Must not be null. Keys used internally by Saxon are prefixed "saxon:".
        value - The value to be set for the property. May be null, which effectively
      • getUserData

        public java.lang.Object getUserData​(java.lang.String key)
        Get user data held in the tree. This retrieves properties previously set using setUserData(java.lang.String, java.lang.Object)
        Specified by:
        getUserData in interface TreeInfo
        Parameters:
        key - A string giving the name of the property to be retrieved.
        Returns:
        the value of the property, or null if the property has not been defined.
      • isStreamed

        public boolean isStreamed()