Package net.sf.saxon.tree.wrapper
Class SpaceStrippedDocument
- java.lang.Object
-
- net.sf.saxon.om.GenericTreeInfo
-
- net.sf.saxon.tree.wrapper.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.
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.om.GenericTreeInfo
root
-
-
Constructor Summary
Constructors Constructor Description SpaceStrippedDocument(TreeInfo doc, SpaceStrippingRule strippingRule)
Create a space-stripped view of a document
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsAssertions()
Ask whether the stripped document contain any nodes annotated with types that carry assertionsboolean
containsPreserveSpace()
Ask whether the stripped document contains any xml:space="preserve" attributes.SpaceStrippingRule
getStrippingRule()
Get the document's strippingRulejava.lang.String[]
getUnparsedEntity(java.lang.String name)
Get the unparsed entity with a given namejava.util.Iterator<java.lang.String>
getUnparsedEntityNames()
Get the list of unparsed entities defined in this documentboolean
isTyped()
Ask whether the document contains any nodes whose type annotation is anything other than UNTYPEDNodeInfo
selectID(java.lang.String id, boolean getParent)
Get the element with a given ID, if anySpaceStrippedNode
wrap(NodeInfo node)
Create a wrapped node within this document-
Methods inherited from class net.sf.saxon.om.GenericTreeInfo
getConfiguration, getDocumentNumber, getPublicId, getRootNode, getSpaceStrippingRule, getSystemId, getUserData, isStreamed, setConfiguration, setDocumentNumber, setRootNode, setSpaceStrippingRule, setSystemId, setUserData
-
-
-
-
Constructor Detail
-
SpaceStrippedDocument
public SpaceStrippedDocument(TreeInfo doc, SpaceStrippingRule strippingRule)
Create a space-stripped view of a document- Parameters:
doc
- the underlying documentstrippingRule
- 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 interfaceTreeInfo
- Overrides:
selectID
in classGenericTreeInfo
- Parameters:
id
- the required ID valuegetParent
- 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.
-
getUnparsedEntityNames
public java.util.Iterator<java.lang.String> getUnparsedEntityNames()
Get the list of unparsed entities defined in this document- Specified by:
getUnparsedEntityNames
in interfaceTreeInfo
- Overrides:
getUnparsedEntityNames
in classGenericTreeInfo
- 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 interfaceTreeInfo
- Overrides:
getUnparsedEntity
in classGenericTreeInfo
- 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
-
-