Package net.sf.saxon.tree.wrapper
Class SpaceStrippedNode
- java.lang.Object
- 
- net.sf.saxon.tree.wrapper.AbstractVirtualNode
- 
- net.sf.saxon.tree.wrapper.SpaceStrippedNode
 
 
- 
- All Implemented Interfaces:
- javax.xml.transform.Source,- javax.xml.transform.SourceLocator,- GroundedValue,- Item,- NodeInfo,- Sequence,- Location,- VirtualNode,- WrappingFunction,- org.xml.sax.Locator
 
 public class SpaceStrippedNode extends AbstractVirtualNode implements WrappingFunction A StrippedNode is a view of a node, in a virtual tree that has whitespace text nodes stripped from it. All operations on the node produce the same result as operations on the real underlying node, except that iterations over the axes take care to skip whitespace-only text nodes that are supposed to be stripped. Note that this class is only used in cases where a pre-built tree is supplied as the input to a transformation, and where the stylesheet does whitespace stripping; if a SAXSource or StreamSource is supplied, whitespace is stripped as the tree is built.
- 
- 
Field Summary- 
Fields inherited from class net.sf.saxon.tree.wrapper.AbstractVirtualNodedocWrapper, node, parent
 - 
Fields inherited from interface net.sf.saxon.om.NodeInfoIS_DTD_TYPE, IS_NILLED
 
- 
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedSpaceStrippedNode()protectedSpaceStrippedNode(NodeInfo node, SpaceStrippedNode parent)This constructor is protected: nodes should be created using the makeWrapper factory method
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AtomicSequenceatomize()Get the typed value.intcompareOrder(NodeInfo other)Determine the relative position of this node and another node, in document order.voidcopy(Receiver out, int copyOptions, Location locationId)Copy this node to a given outputter (deep copy)booleanequals(java.lang.Object other)Determine whether this is the same node as another node.NodeInfogetParent()Get the NodeInfo object representing the parent of this nodejava.lang.CharSequencegetStringValueCS()Get the value of the item as a CharSequence.static booleanisPreservedNode(NodeInfo node, SpaceStrippedDocument docWrapper, NodeInfo actualParent)Ask whether a node is preserved after whitespace strippingAxisIteratoriterateAxis(int axisNumber)Return an iteration over the nodes reached by the given axis from this nodeAxisIteratoriterateAxis(int axisNumber, java.util.function.Predicate<? super NodeInfo> nodeTest)Return an iteration over the nodes reached by the given axis from this nodeprotected static SpaceStrippedNodemakeWrapper(NodeInfo node, SpaceStrippedDocument docWrapper, SpaceStrippedNode parent)Factory method to wrap a node with a wrapper that implements the Saxon NodeInfo interface.VirtualNodemakeWrapper(NodeInfo node, VirtualNode parent)Factory method to wrap a node within the same document as this node with a VirtualNode- 
Methods inherited from class net.sf.saxon.tree.wrapper.AbstractVirtualNodegenerateId, getAllNamespaces, getAttributeValue, getBaseURI, getColumnNumber, getDeclaredNamespaces, getDisplayName, getFingerprint, getLineNumber, getLocalPart, getNodeKind, getPrefix, getRealNode, getRoot, getSchemaType, getStringValue, getSystemId, getTreeInfo, getUnderlyingNode, getURI, hasChildNodes, hasFingerprint, hashCode, isId, isIdref, isNilled, saveLocation, setSystemId
 - 
Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface net.sf.saxon.om.GroundedValueasIterable, concatenate, containsNode, effectiveBooleanValue, materialize
 - 
Methods inherited from interface net.sf.saxon.om.ItemgetLength, head, itemAt, iterate, reduce, subsequence
 - 
Methods inherited from interface net.sf.saxon.om.NodeInfoattributes, children, children, getConfiguration, getGenre, getPublicId, isSameNodeInfo, isStreamed, toShortString
 - 
Methods inherited from interface net.sf.saxon.om.SequencemakeRepeatable
 
- 
 
- 
- 
- 
Constructor Detail- 
SpaceStrippedNodeprotected SpaceStrippedNode() 
 - 
SpaceStrippedNodeprotected SpaceStrippedNode(NodeInfo node, SpaceStrippedNode parent) This constructor is protected: nodes should be created using the makeWrapper factory method- Parameters:
- node- The node to be wrapped
- parent- The StrippedNode that wraps the parent of this node
 
 
- 
 - 
Method Detail- 
makeWrapperprotected static SpaceStrippedNode makeWrapper(NodeInfo node, SpaceStrippedDocument docWrapper, SpaceStrippedNode parent) Factory method to wrap a node with a wrapper that implements the Saxon NodeInfo interface.- Parameters:
- node- The underlying node
- docWrapper- The wrapper for the document node (must be supplied)
- parent- The wrapper for the parent of the node (null if unknown)
- Returns:
- The new wrapper for the supplied node
 
 - 
makeWrapperpublic VirtualNode makeWrapper(NodeInfo node, VirtualNode parent) Factory method to wrap a node within the same document as this node with a VirtualNode- Specified by:
- makeWrapperin interface- WrappingFunction
- Parameters:
- node- The underlying node
- parent- The wrapper for the parent of the node (null if unknown)
- Returns:
- The new wrapper for the supplied node
 
 - 
isPreservedNodepublic static boolean isPreservedNode(NodeInfo node, SpaceStrippedDocument docWrapper, NodeInfo actualParent) Ask whether a node is preserved after whitespace stripping- Parameters:
- node- the node in question
- docWrapper- the root of the space-stripped virtual tree
- actualParent- the (real) parent of the node in question
- Returns:
- true if the node survives whitespace-stripping
 
 - 
atomizepublic AtomicSequence atomize() throws XPathException Get the typed value.- Specified by:
- atomizein interface- Item
- Specified by:
- atomizein interface- NodeInfo
- Overrides:
- atomizein class- AbstractVirtualNode
- Returns:
- the typed value.
- Throws:
- XPathException- if the node has no typed value, for example if it is an element node with element-only content
- Since:
- 8.5
 
 - 
equalspublic boolean equals(java.lang.Object other) Determine whether this is the same node as another node.Note: a.isSameNode(b) if and only if generateId(a)==generateId(b) - Specified by:
- equalsin interface- NodeInfo
- Overrides:
- equalsin class- AbstractVirtualNode
- Parameters:
- other- the node to be compared with this node
- Returns:
- true if this Node object and the supplied Node object represent the same node in the tree.
 
 - 
compareOrderpublic int compareOrder(NodeInfo other) Determine the relative position of this node and another node, in document order. The other node will always be in the same document.- Specified by:
- compareOrderin interface- NodeInfo
- Overrides:
- compareOrderin class- AbstractVirtualNode
- Parameters:
- other- The other node, whose position is to be compared with this node
- Returns:
- -1 if this node precedes the other node, +1 if it follows the other node, or 0 if they are the same node. (In this case, isSameNode() will always return true, and the two nodes will produce the same result for generateId())
 
 - 
getStringValueCSpublic java.lang.CharSequence getStringValueCS() Get the value of the item as a CharSequence. This is in some cases more efficient than the version of the method that returns a String.- Specified by:
- getStringValueCSin interface- GroundedValue
- Specified by:
- getStringValueCSin interface- Item
- Overrides:
- getStringValueCSin class- AbstractVirtualNode
- Returns:
- the string value of the item
- See Also:
- Item.getStringValue()
 
 - 
getParentpublic NodeInfo getParent() Get the NodeInfo object representing the parent of this node
 - 
iterateAxispublic AxisIterator iterateAxis(int axisNumber, java.util.function.Predicate<? super NodeInfo> nodeTest) Description copied from class:AbstractVirtualNodeReturn an iteration over the nodes reached by the given axis from this node- Specified by:
- iterateAxisin interface- NodeInfo
- Overrides:
- iterateAxisin class- AbstractVirtualNode
- Parameters:
- axisNumber- the axis to be used
- nodeTest- A pattern to be matched by the returned nodes
- Returns:
- a SequenceIterator that scans the nodes reached by the axis in turn.
- See Also:
- AxisInfo
 
 - 
iterateAxispublic AxisIterator iterateAxis(int axisNumber) Return an iteration over the nodes reached by the given axis from this node- Specified by:
- iterateAxisin interface- NodeInfo
- Parameters:
- axisNumber- the axis to be used
- Returns:
- a SequenceIterator that scans the nodes reached by the axis in turn.
- See Also:
- AxisInfo
 
 - 
copypublic void copy(Receiver out, int copyOptions, Location locationId) throws XPathException Copy this node to a given outputter (deep copy)- Specified by:
- copyin interface- NodeInfo
- Parameters:
- out- the Receiver to which the node should be copied. It is the caller's responsibility to ensure that this Receiver is open before the method is called (or that it is self-opening), and that it is closed after use.
- copyOptions- a selection of the options defined in- CopyOptions
- locationId- If non-null, identifies the location of the instruction that requested this copy. If zero, indicates that the location information is not available
- Throws:
- XPathException- if any downstream error occurs
 
 
- 
 
-