Package net.sf.saxon.tree.wrapper
Class SnapshotNode
- java.lang.Object
-
- net.sf.saxon.tree.wrapper.VirtualCopy
-
- net.sf.saxon.tree.wrapper.SnapshotNode
-
- All Implemented Interfaces:
javax.xml.transform.Source,javax.xml.transform.SourceLocator,GroundedValue,Item,NodeInfo,Sequence,Location,org.xml.sax.Locator
public class SnapshotNode extends VirtualCopy implements NodeInfo
This class represents a node within a tree produced by the snapshot() function, as a virtual copy of the relevant nodes in another tree. It specializes VirtualCopy, which implements a deep copy as produced by the copy-of() function.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.sf.saxon.tree.wrapper.VirtualCopy
VirtualCopy.VirtualCopier
-
-
Field Summary
Fields Modifier and Type Field Description protected NodeInfopivot-
Fields inherited from class net.sf.saxon.tree.wrapper.VirtualCopy
original, parent, root, systemIdSupplier, tree
-
Fields inherited from interface net.sf.saxon.om.NodeInfo
IS_DTD_TYPE, IS_NILLED
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSnapshotNode(NodeInfo base, NodeInfo pivot)Protected constructor: create a virtual copy of a node
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AtomicSequenceatomize()Get the typed value of this nodevoidcopy(Receiver out, int copyOptions, Location locationId)Copy this node to a given outputterNodeInfogetParent()Get the NodeInfo object representing the parent of this nodejava.lang.StringgetPublicId()Return the public identifier for the current document event.NodeInfogetRoot()Get the root node of the tree containing this nodejava.lang.CharSequencegetStringValueCS()Get the value of the item as a CharSequence.booleanisId()Determine whether this node has the is-id propertybooleanisIdref()Determine whether this node has the is-idref propertyprotected booleanisIncludedInCopy(NodeInfo sourceNode)Ask whether a node in the source tree is within the scope of this virtual copybooleanisNilled()Determine whether the node has the is-nilled propertyAxisIteratoriterateAxis(int axisNumber, java.util.function.Predicate<? super NodeInfo> nodeTest)Return an iteration over all the nodes reached by the given axis from this node that match a given NodeTeststatic SnapshotNodemakeSnapshot(NodeInfo original)Public factory method: apply the snapshot function to a nodeprotected SnapshotNodewrap(NodeInfo node)Wrap a node in a VirtualCopy.-
Methods inherited from class net.sf.saxon.tree.wrapper.VirtualCopy
compareOrder, equals, generateId, getAllNamespaces, getAttributeValue, getBaseURI, getColumnNumber, getConfiguration, getDeclaredNamespaces, getDisplayName, getFingerprint, getLineNumber, getLocalPart, getNodeKind, getOriginalNode, getPrefix, getSchemaType, getStringValue, getSystemId, getTreeInfo, getURI, hasChildNodes, hasFingerprint, hashCode, makeCopier, makeVirtualCopy, saveLocation, setDropNamespaces, setSystemId
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.om.GroundedValue
asIterable, concatenate, containsNode, effectiveBooleanValue, materialize
-
Methods inherited from interface net.sf.saxon.om.Item
getLength, head, itemAt, iterate, reduce, subsequence
-
Methods inherited from interface net.sf.saxon.s9api.Location
saveLocation
-
Methods inherited from interface net.sf.saxon.om.NodeInfo
attributes, children, children, compareOrder, equals, generateId, getAllNamespaces, getAttributeValue, getBaseURI, getColumnNumber, getConfiguration, getDeclaredNamespaces, getDisplayName, getFingerprint, getGenre, getLineNumber, getLocalPart, getNodeKind, getPrefix, getSchemaType, getStringValue, getSystemId, getTreeInfo, getURI, hasChildNodes, hasFingerprint, hashCode, isSameNodeInfo, isStreamed, iterateAxis, toShortString
-
Methods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
-
-
-
Field Detail
-
pivot
protected NodeInfo pivot
-
-
Constructor Detail
-
SnapshotNode
protected SnapshotNode(NodeInfo base, NodeInfo pivot)
Protected constructor: create a virtual copy of a node- Parameters:
base- the node in the source tree to which the new node should correspondpivot- the pivot node is the node supplied as argument to the snapshot() function; the snapshot includes all ancestors of this node, and all descendants of this node (plus their attributes and namespaces)
-
-
Method Detail
-
makeSnapshot
public static SnapshotNode makeSnapshot(NodeInfo original)
Public factory method: apply the snapshot function to a node- Parameters:
original- the node to be copied- Returns:
- the snapshot.
-
wrap
protected SnapshotNode wrap(NodeInfo node)
Wrap a node in a VirtualCopy.- Overrides:
wrapin classVirtualCopy- Parameters:
node- the node to be wrapped- Returns:
- a virtual copy of the node
-
getStringValueCS
public java.lang.CharSequence getStringValueCS()
Get the value of the item as a CharSequence. The string value for a node below the pivot is the same as the string value for the corresponding node in the source tree; the string value for a node above the pivot is the same as the string value of the pivot. For attributes and namespaces the string value is the same as in the original tree.- Specified by:
getStringValueCSin interfaceGroundedValue- Specified by:
getStringValueCSin interfaceItem- Overrides:
getStringValueCSin classVirtualCopy- Returns:
- the string value of the item
- See Also:
Item.getStringValue()
-
getParent
public NodeInfo getParent()
Get the NodeInfo object representing the parent of this node- Specified by:
getParentin interfaceNodeInfo- Overrides:
getParentin classVirtualCopy- Returns:
- the parent of this node; null if this node has no parent
-
getRoot
public NodeInfo getRoot()
Get the root node of the tree containing this node- Specified by:
getRootin interfaceNodeInfo- Overrides:
getRootin classVirtualCopy- Returns:
- the NodeInfo representing the top-level ancestor of this node. This will not necessarily be a document node
-
copy
public void copy(Receiver out, int copyOptions, Location locationId) throws XPathException
Copy this node to a given outputter- Specified by:
copyin interfaceNodeInfo- Overrides:
copyin classVirtualCopy- Parameters:
out- the Receiver to which the node should be copiedcopyOptions- a selection of the options defined inCopyOptionslocationId- Identifies the location of the instruction- Throws:
XPathException- if any downstream error occurs
-
atomize
public AtomicSequence atomize() throws XPathException
Get the typed value of this node- Specified by:
atomizein interfaceItem- Specified by:
atomizein interfaceNodeInfo- Overrides:
atomizein classVirtualCopy- 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
-
isId
public boolean isId()
Determine whether this node has the is-id property- Specified by:
isIdin interfaceNodeInfo- Overrides:
isIdin classVirtualCopy- Returns:
- true if the node is an ID
-
isIdref
public boolean isIdref()
Determine whether this node has the is-idref property- Specified by:
isIdrefin interfaceNodeInfo- Overrides:
isIdrefin classVirtualCopy- Returns:
- true if the node is an IDREF or IDREFS element or attribute
-
isNilled
public boolean isNilled()
Determine whether the node has the is-nilled property- Specified by:
isNilledin interfaceNodeInfo- Overrides:
isNilledin classVirtualCopy- Returns:
- true if the node has the is-nilled property
-
getPublicId
public java.lang.String getPublicId()
Return the public identifier for the current document event.The return value is the public identifier of the document entity or of the external parsed entity in which the markup that triggered the event appears.
- Specified by:
getPublicIdin interfaceLocation- Specified by:
getPublicIdin interfaceorg.xml.sax.Locator- Specified by:
getPublicIdin interfaceNodeInfo- Specified by:
getPublicIdin interfacejavax.xml.transform.SourceLocator- Overrides:
getPublicIdin classVirtualCopy- Returns:
- A string containing the public identifier, or null if none is available.
- See Also:
VirtualCopy.getSystemId()
-
iterateAxis
public AxisIterator iterateAxis(int axisNumber, java.util.function.Predicate<? super NodeInfo> nodeTest)
Return an iteration over all the nodes reached by the given axis from this node that match a given NodeTest- Specified by:
iterateAxisin interfaceNodeInfo- Overrides:
iterateAxisin classVirtualCopy- Parameters:
axisNumber- an integer identifying the axis; one of the constants defined in class net.sf.saxon.om.AxisnodeTest- A pattern to be matched by the returned nodes; nodes that do not match this pattern are not included in the result- Returns:
- an AxisIterator that scans the nodes reached by the axis in turn.
- Throws:
java.lang.UnsupportedOperationException- if the namespace axis is requested and this axis is not supported for this implementation.- See Also:
AxisInfo
-
isIncludedInCopy
protected boolean isIncludedInCopy(NodeInfo sourceNode)
Description copied from class:VirtualCopyAsk whether a node in the source tree is within the scope of this virtual copy- Overrides:
isIncludedInCopyin classVirtualCopy- Parameters:
sourceNode- the node being tested- Returns:
- true if the node is within the scope of the subtree
-
-