Class SpaceStrippedDocument

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

    public class SpaceStrippedDocument
    extends GenericTreeInfo
    A SpaceStrippedDocument represents a view of a real Document in which selected whitespace text nodes are treated as having been stripped.
    • Constructor Detail

      • SpaceStrippedDocument

        public SpaceStrippedDocument​(TreeInfo doc,
                                     SpaceStrippingRule strippingRule)
        Create a space-stripped view of a document
        Parameters:
        doc - the underlying document
        strippingRule - an object that contains the rules defining which whitespace text nodes are to be absent from the view
    • Method Detail

      • wrap

        public SpaceStrippedNode wrap​(NodeInfo node)
        Create a wrapped node within this document
        Parameters:
        node - the node to be wrapped
        Returns:
        the wrapped node
      • 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
      • getStrippingRule

        public SpaceStrippingRule getStrippingRule()
        Get the document's strippingRule
        Returns:
        the strippingRule
      • 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
        Overrides:
        selectID in class GenericTreeInfo
        Parameters:
        id - the required ID value
        getParent - true if we want the parent of an element with the ID value
        Returns:
        the element with the given ID value, or null if there is none.
      • getDurability

        public Durability getDurability()
        Description copied from interface: TreeInfo
        Get the durability of nodes in the tree. This affects how they are handled in a memo function cache, to optimize memory and garbage collection. By default, all nodes are considered durable unless otherwise specified
        Specified by:
        getDurability in interface TreeInfo
        Overrides:
        getDurability in class GenericTreeInfo
        Returns:
        the durability property of this node tree
      • 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.
      • containsPreserveSpace

        public boolean containsPreserveSpace()
        Ask whether the stripped document contains any xml:space="preserve" attributes.
        Returns:
        true if any element in the document has an xml:space attribute with the value "preserve"
      • containsAssertions

        public boolean containsAssertions()
        Ask whether the stripped document contain any nodes annotated with types that carry assertions
        Returns:
        true if any element in the document has a type that has an assertion