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
        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

      • isTyped

        public boolean isTyped()
        Ask whether the document contains any nodes whose type annotation is anything other than UNTYPED
        true if the document contains elements whose type is other than UNTYPED
      • getStrippingRule

        public SpaceStrippingRule getStrippingRule()
        Get the document's 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
        selectID in class GenericTreeInfo
        id - the required ID value
        getParent - true if we want the parent of an element with the ID value
        the element with the given ID value, or null if there is none.
      • 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
        getUnparsedEntityNames in class GenericTreeInfo
        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
        getUnparsedEntity in class GenericTreeInfo
        name - the name of the entity
        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.
        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
        true if any element in the document has a type that has an assertion