Package net.sf.saxon.tree.tiny
Class TinyTextualElement
- 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.TinyTextualElement
-
- All Implemented Interfaces:
javax.xml.transform.Source
,javax.xml.transform.SourceLocator
,GroundedValue
,Item
,NodeInfo
,Sequence
,Location
,org.xml.sax.Locator
public class TinyTextualElement extends TinyElementImpl
An element node in the TinyTree that has no attributes or namespace declarations and that has a single text node child. The element-and-text-node pair are represented by a single entry in the node arrays, but materialize as two separate objects when turned into node objects.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
TinyTextualElement.TinyTextualElementText
Inner class representing the text node; this is created on demand
-
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 TinyTextualElement(TinyTree tree, int nodeNr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copy(Receiver receiver, int copyOptions, Location location)
Copy this node to a given receiverNamespaceMap
getAllNamespaces()
Get all the namespace bindings that are in-scope for this element.java.lang.String
getAttributeValue(int fp)
Get the value of the attribute with a given fingerprint.java.lang.String
getAttributeValue(java.lang.String uri, java.lang.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.java.lang.String
getStringValue()
Return the string-value of the node, that is, the concatenation of the character content of all descendent elements and text nodes.java.lang.CharSequence
getStringValueCS()
Get the value of the item as a CharSequence.TinyTextualElement.TinyTextualElementText
getTextNode()
Make an instance of the text nodeboolean
hasChildNodes()
Determine if the node has children.boolean
isAncestorOrSelf(TinyNodeImpl d)
Test if this node is an ancestor-or-self of anotherAxisIterator
iterateAxis(int axisNumber)
Return an iterator over all the nodes reached by the given axis from this nodeAxisIterator
iterateAxis(int axisNumber, java.util.function.Predicate<? super NodeInfo> 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
atomize, checkNotNamespaceSensitiveElement, getBaseURI, 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, getPrefix, getRoot, getSequenceNumber, getSystemId, getTree, getTreeInfo, getURI, hasFingerprint, hashCode, head, isNilled, isSameNodeInfo, isStreamed, 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, concatenate, containsNode, effectiveBooleanValue, materialize
-
Methods inherited from interface net.sf.saxon.om.Item
getLength, itemAt, iterate, reduce, subsequence
-
Methods inherited from interface net.sf.saxon.om.NodeInfo
attributes, children, children, getPublicId, toShortString
-
Methods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
-
-
-
Constructor Detail
-
TinyTextualElement
public TinyTextualElement(TinyTree tree, int nodeNr)
-
-
Method Detail
-
getDeclaredNamespaces
public NamespaceBinding[] getDeclaredNamespaces(NamespaceBinding[] buffer)
Description copied from class:TinyElementImpl
Get all namespace undeclarations and undeclarations defined on this element.- Specified by:
getDeclaredNamespaces
in interfaceNodeInfo
- Overrides:
getDeclaredNamespaces
in 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.
-
getAllNamespaces
public NamespaceMap getAllNamespaces()
Description copied from class:TinyNodeImpl
Get all the namespace bindings that are in-scope for this element.For an element return all the prefix-to-uri bindings that are in scope. This may include a binding to the default namespace (represented by a prefix of ""). It will never include "undeclarations" - that is, the namespace URI will never be empty; the effect of an undeclaration is to remove a binding from the in-scope namespaces, not to add anything.
For a node other than an element, returns null.
- Specified by:
getAllNamespaces
in interfaceNodeInfo
- Overrides:
getAllNamespaces
in classTinyElementImpl
- Returns:
- the in-scope namespaces for an element, or null for any other kind of node.
-
getAttributeValue
public java.lang.String getAttributeValue(java.lang.String uri, java.lang.String local)
Description copied from class:TinyElementImpl
Get the string value of a given attribute of this node- Specified by:
getAttributeValue
in interfaceNodeInfo
- Overrides:
getAttributeValue
in 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.
-
getAttributeValue
public java.lang.String getAttributeValue(int fp)
Description copied from class:TinyElementImpl
Get the value of the attribute with a given fingerprint.- Overrides:
getAttributeValue
in classTinyElementImpl
- Parameters:
fp
- the fingerprint of the required attribute- Returns:
- the string value of the attribute if present, or null if absent
-
copy
public void copy(Receiver receiver, int copyOptions, Location location) throws XPathException
Description copied from class:TinyElementImpl
Copy this node to a given receiver- Specified by:
copy
in interfaceNodeInfo
- Overrides:
copy
in classTinyElementImpl
- Parameters:
receiver
- the destination of the copycopyOptions
- determines handling of namespaces, etclocation
- location information associated with the event- Throws:
XPathException
- if any downstream error occurs
-
hasChildNodes
public boolean hasChildNodes()
Description copied from class:TinyParentNodeImpl
Determine if the node has children.- Specified by:
hasChildNodes
in interfaceNodeInfo
- Overrides:
hasChildNodes
in classTinyParentNodeImpl
- Returns:
true
if this node has any attributes,false
otherwise.
-
getStringValueCS
public java.lang.CharSequence getStringValueCS()
Description copied from class:TinyParentNodeImpl
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:
getStringValueCS
in interfaceGroundedValue
- Specified by:
getStringValueCS
in interfaceItem
- Overrides:
getStringValueCS
in classTinyParentNodeImpl
- Returns:
- the string value of the item
- See Also:
Item.getStringValue()
-
getStringValue
public java.lang.String getStringValue()
Description copied from class:TinyParentNodeImpl
Return the string-value of the node, that is, the concatenation of the character content of all descendent elements and text nodes.- Specified by:
getStringValue
in interfaceGroundedValue
- Specified by:
getStringValue
in interfaceItem
- Specified by:
getStringValue
in interfaceNodeInfo
- Overrides:
getStringValue
in classTinyParentNodeImpl
- Returns:
- the accumulated character content of the element, including descendant elements.
- See Also:
Item.getStringValueCS()
-
iterateAxis
public AxisIterator iterateAxis(int axisNumber)
Description copied from class:TinyNodeImpl
Return an iterator over all the nodes reached by the given axis from this node- Specified by:
iterateAxis
in interfaceNodeInfo
- Overrides:
iterateAxis
in 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(int axisNumber, java.util.function.Predicate<? super NodeInfo> nodeTest)
Description copied from class:TinyNodeImpl
Return an iterator over the nodes reached by the given axis from this node- Specified by:
iterateAxis
in interfaceNodeInfo
- Overrides:
iterateAxis
in classTinyNodeImpl
- Parameters:
axisNumber
- Identifies the required axis, eg. Axis.CHILD or Axis.PARENTnodeTest
- A condition to be matched by the returned nodes.- Returns:
- a AxisIteratorImpl that scans the nodes reached by the axis in turn.
- See Also:
AxisInfo
-
isAncestorOrSelf
public boolean isAncestorOrSelf(TinyNodeImpl d)
Description copied from class:TinyNodeImpl
Test if this node is an ancestor-or-self of another- Overrides:
isAncestorOrSelf
in classTinyNodeImpl
- Parameters:
d
- the putative descendant-or-self node- Returns:
- true if this node is an ancestor-or-self of d
-
getTextNode
public TinyTextualElement.TinyTextualElementText getTextNode()
Make an instance of the text node- Returns:
- the new or existing instance
-
-