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:
Source,SourceLocator,ActiveSource,GNode,GroundedValue,Item,NodeInfo,Sequence,Location,Locator
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
FieldsFields inherited from class net.sf.saxon.tree.wrapper.VirtualCopy
original, parent, root, systemIdSupplier, tree -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSnapshotNode(NodeInfo base, NodeInfo pivot) Protected constructor: create a virtual copy of a node -
Method Summary
Modifier and TypeMethodDescriptionatomize()Get the typed value of this nodevoidCopy this node to a given outputterGet the NodeInfo object representing the parent of this nodeReturn the public identifier for the _current document event.getRoot()Get the root node of the tree containing this nodeGet the string value of the item.booleanTest whether this node is an ancestor of the pivot nodebooleanisId()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 propertyiterateChildAxis(NodePredicate predicate) Get an iterator over the child axis, starting at this node; the nodes will be in document order.iterateDescendantAxis(NodePredicate predicate) Get an iterator over the descendant axis, starting at this node; the nodes will be in document order.iterateDescendantOrSelfAxis(NodePredicate predicate) Get an iterator over the descendant-or-self axis, starting at this node; the nodes will be in document order.iterateFollowingAxis(NodePredicate predicate) Get an iterator over the following axis, starting at this node; the nodes will be in document order.iterateFollowingSiblingAxis(NodePredicate predicate) Get an iterator over the following-sibling axis, starting at this node; the nodes will be in document order.iteratePrecedingAxis(NodePredicate predicate) Get an iterator over the preceding axis, starting at this node; the nodes will be in reverse document order.iteratePrecedingSiblingAxis(NodePredicate predicate) Get an iterator over the preceding-sibling axis, starting at this node; the nodes will be in reverse document order.static SnapshotNodemakeSnapshot(NodeInfo original) Public factory method: apply the snapshot function to a nodeprotected SnapshotNodeWrap 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, getNamespaceUri, getNodeKind, getOriginalNode, getPrefix, getSchemaType, getSystemId, getTreeInfo, hasChildNodes, hasFingerprint, hashCode, iterateAttributeAxis, iterateSelfAxis, makeCopier, makeVirtualCopy, saveLocation, setDropNamespaces, setSystemIdMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.sf.saxon.om.GNode
generateId, iterateAncestorAxis, iterateAncestorOrSelfAxis, iterateAttributeAxis, iterateFollowingOrSelfAxis, iterateFollowingSiblingOrSelfAxis, iterateNamespaceAxis, iterateParentAxis, iteratePrecedingOrSelfAxis, iteratePrecedingSiblingOrSelfAxis, iterateSelfAxisMethods inherited from interface net.sf.saxon.om.GroundedValue
asIterable, concatenate, containsNode, effectiveBooleanValue, materializeMethods inherited from interface net.sf.saxon.om.Item
getLabel, getLength, getStringValue, head, itemAt, iterate, reduce, subsequenceMethods inherited from interface net.sf.saxon.s9api.Location
saveLocationMethods inherited from interface net.sf.saxon.om.NodeInfo
asActiveSource, attributes, children, children, compareOrder, deliver, equals, getAllNamespaces, getAttributeValue, getBaseURI, getColumnNumber, getConfiguration, getDeclaredNamespaces, getDisplayName, getFingerprint, getGenre, getLineNumber, getLocalPart, getNamespaceUri, getNodeKind, getPrefix, getQName, getSchemaType, getSystemId, getTreeInfo, getURI, hasChildNodes, hasFingerprint, hashCode, isSameNodeInfo, isStreamed, setSystemId, toShortStringMethods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
Field Details
-
pivot
-
-
Constructor Details
-
SnapshotNode
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 Details
-
makeSnapshot
Public factory method: apply the snapshot function to a node- Parameters:
original- the node to be copied- Returns:
- the snapshot.
-
wrap
Wrap a node in a VirtualCopy.- Overrides:
wrapin classVirtualCopy- Parameters:
node- the node to be wrapped- Returns:
- a virtual copy of the node
-
getUnicodeStringValue
Get the string value of the item. 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:
getUnicodeStringValuein interfaceGroundedValue- Specified by:
getUnicodeStringValuein interfaceItem- Overrides:
getUnicodeStringValuein classVirtualCopy- Returns:
- the string value of the node, as a
UnicodeString
-
getParent
Get the NodeInfo object representing the parent of this node -
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
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
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
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 interfaceLocator- Specified by:
getPublicIdin interfaceNodeInfo- Specified by:
getPublicIdin interfaceSourceLocator- Overrides:
getPublicIdin classVirtualCopy- Returns:
- A string containing the public identifier, or null if none is available.
- See Also:
-
isAncestorOfPivot
public boolean isAncestorOfPivot()Test whether this node is an ancestor of the pivot node -
iterateChildAxis
Get an iterator over the child axis, starting at this node; the nodes will be in document order.- Specified by:
iterateChildAxisin interfaceGNode- Overrides:
iterateChildAxisin classVirtualCopy- Parameters:
predicate- a condition that the nodes must satisfy, or null- Returns:
- the required iterator
-
iterateDescendantAxis
Get an iterator over the descendant axis, starting at this node; the nodes will be in document order.- Specified by:
iterateDescendantAxisin interfaceGNode- Overrides:
iterateDescendantAxisin classVirtualCopy- Parameters:
predicate- a condition that the nodes must satisfy, or null- Returns:
- the required iterator
-
iterateDescendantOrSelfAxis
Get an iterator over the descendant-or-self axis, starting at this node; the nodes will be in document order.- Specified by:
iterateDescendantOrSelfAxisin interfaceGNode- Overrides:
iterateDescendantOrSelfAxisin classVirtualCopy- Parameters:
predicate- a condition that the nodes must satisfy, or null- Returns:
- the required iterator
-
iterateFollowingSiblingAxis
Get an iterator over the following-sibling axis, starting at this node; the nodes will be in document order.- Specified by:
iterateFollowingSiblingAxisin interfaceGNode- Overrides:
iterateFollowingSiblingAxisin classVirtualCopy- Parameters:
predicate- a condition that the nodes must satisfy, or null- Returns:
- the required iterator
-
iteratePrecedingSiblingAxis
Get an iterator over the preceding-sibling axis, starting at this node; the nodes will be in reverse document order.- Specified by:
iteratePrecedingSiblingAxisin interfaceGNode- Overrides:
iteratePrecedingSiblingAxisin classVirtualCopy- Parameters:
predicate- a condition that the nodes must satisfy, or null- Returns:
- the required iterator
-
iterateFollowingAxis
Get an iterator over the following axis, starting at this node; the nodes will be in document order.- Specified by:
iterateFollowingAxisin interfaceGNode- Overrides:
iterateFollowingAxisin classVirtualCopy- Parameters:
predicate- a condition that the nodes must satisfy, or null- Returns:
- the required iterator
-
iteratePrecedingAxis
Get an iterator over the preceding axis, starting at this node; the nodes will be in reverse document order.- Specified by:
iteratePrecedingAxisin interfaceGNode- Overrides:
iteratePrecedingAxisin classVirtualCopy- Parameters:
predicate- a condition that the nodes must satisfy, or null- Returns:
- the required iterator
-
isIncludedInCopy
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
-