Package net.sf.saxon.tree.tiny
Class GraftedElement
- java.lang.Object
-
- net.sf.saxon.tree.tiny.TinyNodeImpl
-
- net.sf.saxon.tree.tiny.TinyParentNodeImpl
-
- net.sf.saxon.tree.tiny.TinyElementImpl
-
- net.sf.saxon.tree.tiny.GraftedElement
-
- All Implemented Interfaces:
Iterable<NodeInfo>,Source,SourceLocator,Location,GroundedValue<NodeInfo>,Item<NodeInfo>,NodeInfo,Sequence<NodeInfo>,Locator
public class GraftedElement extends TinyElementImpl
This class represents an element node in a TinyTree that is actually a reference to an element node held elsewhere. Some properties of the node come from the containing TinyTree (for example, document number, base URI, etc) while others are actually properties of the external node. Notably, the parent and siblings of the node are found in the containing tree, while the children and descendants (and attributes) are found in the external tree.
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.tree.tiny.TinyNodeImpl
NODE_LETTER, nodeNr, parent, tree
-
Fields inherited from interface net.sf.saxon.om.NodeInfo
IS_DTD_TYPE, IS_NILLED
-
-
Constructor Summary
Constructors Constructor Description GraftedElement(TinyTree tree, int nodeNr, NodeInfo externalNode, boolean copyNamespaces)Created a grafted element node
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AtomicSequenceatomize()Get the typed value.voidcopy(Receiver receiver, int copyOptions, Location location)Copy this node to a given receiverStringgetAttributeValue(int fp)Get the value of the attribute with a given fingerprint.StringgetAttributeValue(String uri, String local)Get the string value of a given attribute of this nodeNamespaceBinding[]getDeclaredNamespaces(NamespaceBinding[] buffer)Get all namespace undeclarations and undeclarations defined on this element.NodeInfogetExternalNode()StringgetStringValue()Return the string-value of the node, that is, the concatenation of the character content of all descendent elements and text nodes.CharSequencegetStringValueCS()Get the value of the item as a CharSequence.booleanhasChildNodes()Determine if the node has children.booleanhasDefaultNamespace()AxisIteratoriterateAxis(byte axisNumber)Return an iterator over all the nodes reached by the given axis from this nodeAxisIteratoriterateAxis(byte axisNumber, NodeTest nodeTest)Return an iterator over the nodes reached by the given axis from this node-
Methods inherited from class net.sf.saxon.tree.tiny.TinyElementImpl
checkNotNamespaceSensitiveElement, getBaseURI, getDeclaredNamespaces, getNodeKind, getSchemaType, getURIForPrefix, hasUniformNamespaces, isId, isIdref
-
Methods inherited from class net.sf.saxon.tree.tiny.TinyParentNodeImpl
getStringValueCS
-
Methods inherited from class net.sf.saxon.tree.tiny.TinyNodeImpl
compareOrder, equals, generateId, getColumnNumber, getConfiguration, getDisplayName, getFingerprint, getGenre, getLineNumber, getLocalPart, getNamePool, getNodeNumber, getParent, getParentNodeNr, getPrefix, getRoot, getSequenceNumber, getSystemId, getTree, getTreeInfo, getURI, hasFingerprint, hashCode, head, isAncestorOrSelf, isNilled, isSameNodeInfo, isStreamed, iterate, saveLocation, setParentNode, 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, effectiveBooleanValue, materialize
-
Methods inherited from interface net.sf.saxon.om.Item
getLength, itemAt, iterator, reduce, subsequence
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface net.sf.saxon.om.NodeInfo
getPublicId, toShortString
-
Methods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
-
-
-
Constructor Detail
-
GraftedElement
public GraftedElement(TinyTree tree, int nodeNr, NodeInfo externalNode, boolean copyNamespaces)
Created a grafted element node- Parameters:
tree- the host tree that is to contain a reference to an external nodenodeNr- the node number at which the external reference is to appearexternalNode- the external node, in some other treecopyNamespaces- indicates whether namespaces in the external tree are retained in the virtual copy.
-
-
Method Detail
-
getExternalNode
public NodeInfo getExternalNode()
-
hasChildNodes
public boolean hasChildNodes()
Description copied from class:TinyParentNodeImplDetermine if the node has children.- Specified by:
hasChildNodesin interfaceNodeInfo- Overrides:
hasChildNodesin classTinyParentNodeImpl- Returns:
trueif this node has any attributes,falseotherwise.
-
getStringValueCS
public CharSequence getStringValueCS()
Description copied from class:TinyParentNodeImplGet 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 interfaceGroundedValue<NodeInfo>- Specified by:
getStringValueCSin interfaceItem<NodeInfo>- Overrides:
getStringValueCSin classTinyParentNodeImpl- Returns:
- the string value of the item
- See Also:
Item.getStringValue()
-
getStringValue
public String getStringValue()
Description copied from class:TinyParentNodeImplReturn the string-value of the node, that is, the concatenation of the character content of all descendent elements and text nodes.- Specified by:
getStringValuein interfaceGroundedValue<NodeInfo>- Specified by:
getStringValuein interfaceItem<NodeInfo>- Specified by:
getStringValuein interfaceNodeInfo- Overrides:
getStringValuein classTinyParentNodeImpl- Returns:
- the accumulated character content of the element, including descendant elements.
- See Also:
Item.getStringValueCS()
-
atomize
public AtomicSequence atomize() throws XPathException
Description copied from class:TinyElementImplGet the typed value.- Specified by:
atomizein interfaceItem<NodeInfo>- Specified by:
atomizein interfaceNodeInfo- Overrides:
atomizein classTinyElementImpl- Returns:
- the typed value. It will be a Value representing a sequence whose items are atomic values.
- Throws:
XPathException- if the node has no typed value, for example if it is an element node with element-only content
-
copy
public void copy(Receiver receiver, int copyOptions, Location location) throws XPathException
Description copied from class:TinyElementImplCopy this node to a given receiver- Specified by:
copyin interfaceNodeInfo- Overrides:
copyin classTinyElementImpl- Parameters:
receiver- 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- determines handling of namespaces, etclocation- location information associated with the event- Throws:
XPathException- if any downstream error occurs
-
iterateAxis
public AxisIterator iterateAxis(byte axisNumber)
Description copied from class:TinyNodeImplReturn an iterator over all the nodes reached by the given axis from this node- Specified by:
iterateAxisin interfaceNodeInfo- Overrides:
iterateAxisin classTinyNodeImpl- Parameters:
axisNumber- Identifies the required axis, eg. Axis.CHILD or Axis.PARENT- Returns:
- a AxisIteratorImpl that scans the nodes reached by the axis in turn.
- See Also:
AxisInfo
-
iterateAxis
public AxisIterator iterateAxis(byte axisNumber, NodeTest nodeTest)
Description copied from class:TinyNodeImplReturn an iterator over the nodes reached by the given axis from this node- Specified by:
iterateAxisin interfaceNodeInfo- Overrides:
iterateAxisin classTinyNodeImpl- Parameters:
axisNumber- Identifies the required axis, eg. Axis.CHILD or Axis.PARENTnodeTest- A pattern to be matched by the returned nodes.- Returns:
- a AxisIteratorImpl that scans the nodes reached by the axis in turn.
- See Also:
AxisInfo
-
getAttributeValue
public String getAttributeValue(int fp)
Get the value of the attribute with a given fingerprint.- Overrides:
getAttributeValuein classTinyElementImpl- Parameters:
fp- the fingerprint of the required attribute- Returns:
- the string value of the attribute if present, or null if absent
-
getAttributeValue
public String getAttributeValue(String uri, String local)
Description copied from class:TinyElementImplGet the string value of a given attribute of this node- Specified by:
getAttributeValuein interfaceNodeInfo- Overrides:
getAttributeValuein classTinyElementImpl- Parameters:
uri- the namespace URI of the attribute name. Supply the empty string for an attribute that is in no namespacelocal- the local part of the attribute name.- Returns:
- the attribute value if it exists, or null if it does not exist. Always returns null if this node is not an element.
-
hasDefaultNamespace
public boolean hasDefaultNamespace()
-
getDeclaredNamespaces
public NamespaceBinding[] getDeclaredNamespaces(NamespaceBinding[] buffer)
Description copied from class:TinyElementImplGet all namespace undeclarations and undeclarations defined on this element.- Specified by:
getDeclaredNamespacesin interfaceNodeInfo- Overrides:
getDeclaredNamespacesin classTinyElementImpl- Parameters:
buffer- If this is non-null, and the result array fits in this buffer, then the result may overwrite the contents of this array, to avoid the cost of allocating a new array on the heap.- Returns:
- An array of objects representing the namespace declarations and undeclarations present on this element. For a node other than an element, return null. Otherwise, the returned array is a sequence of namespace binding objects (essentially prefix/uri pairs) If the URI is null, then this is a namespace undeclaration rather than a declaration. The XML namespace is never included in the list. If the supplied array is larger than required, then the first unused entry will be set to null.
-
-