Package net.sf.saxon.option.axiom
Class AxiomElementNodeWrapper
java.lang.Object
net.sf.saxon.tree.wrapper.AbstractNodeWrapper
net.sf.saxon.option.axiom.AxiomParentNodeWrapper
net.sf.saxon.option.axiom.AxiomElementNodeWrapper
- All Implemented Interfaces:
Source
,SourceLocator
,ActiveSource
,GroundedValue
,Item
,NodeInfo
,Sequence
,Location
,SiblingCountingNode
,VirtualNode
,Locator
A node in the XDM tree; specifically, a node that wraps an Axiom element node.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.sf.saxon.option.axiom.AxiomParentNodeWrapper
AxiomParentNodeWrapper.ChildWrappingIterator, AxiomParentNodeWrapper.DescendantWrappingIterator
-
Field Summary
FieldsFields inherited from class net.sf.saxon.option.axiom.AxiomParentNodeWrapper
node
Fields inherited from class net.sf.saxon.tree.wrapper.AbstractNodeWrapper
treeInfo
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AxiomElementNodeWrapper
(org.apache.axiom.om.OMElement node, AxiomDocument docWrapper, AxiomParentNodeWrapper parent, int index) This constructor is protected: nodes should be created using the wrap factory method on the DocumentWrapper class -
Method Summary
Modifier and TypeMethodDescriptionint
compareOrder
(NodeInfo other) Determine the relative position of this node and another node, in document order.Get all the namespace bindings that are in-scope for this element.getAttributeValue
(NamespaceUri uri, String local) Get the string value of a given attribute of this nodegetDeclaredNamespaces
(NamespaceBinding[] buffer) Get all namespace undeclarations and undeclarations defined on this element.Get the local part of the name of this node.Get the URI part of the name of this node.int
Return the type of node.Get the NodeInfo object representing the parent of this nodeGet the prefix of the name of the node.getRoot()
Get the root node of the tree containing this nodeGet the type annotation of this node, if any.int
Get the index position of this node among its siblings (starting from 0)protected AxisIterator
iterateAttributes
(NodeTest nodeTest) Return an iterator over the attributes of this element node.protected AxisIterator
iterateSiblings
(NodeTest nodeTest, boolean forwards) Return an iterator over the siblings of this node.Methods inherited from class net.sf.saxon.option.axiom.AxiomParentNodeWrapper
atomize, generateId, getUnderlyingNode, getUnicodeStringValue, hasChildNodes, iterateChildren, iterateDescendants
Methods inherited from class net.sf.saxon.tree.wrapper.AbstractNodeWrapper
equals, getBaseURI, getColumnNumber, getDisplayName, getFingerprint, getLineNumber, getNamePool, getRealNode, getSystemId, getTreeInfo, hasFingerprint, hashCode, iterateAxis, iterateAxis, saveLocation, 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, getStringValue, head, itemAt, iterate, reduce, subsequence
Methods inherited from interface net.sf.saxon.s9api.Location
saveLocation
Methods inherited from interface net.sf.saxon.om.NodeInfo
asActiveSource, attributes, children, children, copy, deliver, equals, getAttributeValue, getBaseURI, getColumnNumber, getConfiguration, getDisplayName, getFingerprint, getGenre, getLineNumber, getPublicId, getSystemId, getTreeInfo, getURI, hasFingerprint, hashCode, isId, isIdref, isNilled, isSameNodeInfo, isStreamed, iterateAxis, iterateAxis, setSystemId, toShortString
Methods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
Field Details
-
docWrapper
-
index
protected int index
-
-
Constructor Details
-
AxiomElementNodeWrapper
protected AxiomElementNodeWrapper(org.apache.axiom.om.OMElement node, AxiomDocument docWrapper, AxiomParentNodeWrapper parent, int index) This constructor is protected: nodes should be created using the wrap factory method on the DocumentWrapper class- Parameters:
node
- The Axiom node to be wrappeddocWrapper
- The wrapper around the document node at the root of the treeparent
- The NodeWrapper that wraps the parent of this nodeindex
- Position of this node among its siblings
-
-
Method Details
-
getNodeKind
public int getNodeKind()Return the type of node.- Returns:
- one of the values Node.ELEMENT, Node.TEXT, Node.ATTRIBUTE, etc.
- See Also:
-
getSchemaType
Get the type annotation of this node, if any. The type annotation is represented as SchemaType object.Types derived from a DTD are not reflected in the result of this method.
- Returns:
- For element and attribute nodes: the type annotation derived from schema validation (defaulting to xs:untyped and xs:untypedAtomic in the absence of schema validation). For comments, text nodes, processing instructions, and namespaces: null. For document nodes, either xs:untyped if the document has not been validated, or xs:anyType if it has.
- Since:
- 9.4
-
compareOrder
Determine the relative position of this node and another node, in document order. The other node will always be in the same document.- 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())
-
getLocalPart
Get the local part of the name of this node. This is the name after the ":" if any.- Returns:
- the local part of the name. For an unnamed node, returns "".
-
getPrefix
Get the prefix of the name of the node. This is defined only for elements and attributes. If the node has no prefix, or for other kinds of node, return a zero-length string.- Returns:
- The prefix of the name of the node.
-
getNamespaceUri
Get the URI part of the name of this node. This is the URI corresponding to the prefix, or the URI of the default namespace if appropriate.- Returns:
- The URI of the namespace of this node. For an unnamed node, or for a node with an empty prefix, return an empty string.
-
getParent
Get the NodeInfo object representing the parent of this node- Returns:
- the parent of this node; null if this node has no parent
-
getSiblingPosition
public int getSiblingPosition()Get the index position of this node among its siblings (starting from 0)- Returns:
- 0 for the first child, 1 for the second child, etc.
-
iterateAttributes
Description copied from class:AbstractNodeWrapper
Return an iterator over the attributes of this element node. This method is only called after checking that the node is an element.- Specified by:
iterateAttributes
in classAbstractNodeWrapper
- Parameters:
nodeTest
- a test that the returned attributes must satisfy- Returns:
- an iterator over the attribute nodes. The order of the result, although arbitrary, must be consistent with document order.
-
iterateSiblings
Description copied from class:AbstractNodeWrapper
Return an iterator over the siblings of this node. This method is only called after checking that the node is an element, text, comment, or PI node.- Specified by:
iterateSiblings
in classAbstractNodeWrapper
- Parameters:
nodeTest
- a test that the returned siblings must satisfyforwards
- true for following siblings, false for preceding siblings- Returns:
- an iterator over the sibling nodes, in axis order.
-
getAttributeValue
Get the string value of a given attribute of this node- Specified by:
getAttributeValue
in interfaceNodeInfo
- Overrides:
getAttributeValue
in classAbstractNodeWrapper
- 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.
- Since:
- 9.4
-
getRoot
Get the root node of the tree containing this node- Specified by:
getRoot
in interfaceNodeInfo
- Overrides:
getRoot
in classAbstractNodeWrapper
- Returns:
- the NodeInfo representing the top-level ancestor of this node. This will not necessarily be a document node
-
getDeclaredNamespaces
Get all namespace undeclarations and undeclarations defined on this element.- Specified by:
getDeclaredNamespaces
in interfaceNodeInfo
- Overrides:
getDeclaredNamespaces
in classAbstractNodeWrapper
- 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 integers 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 codes, whose meaning may be interpreted by reference to the name pool. The
top half word of each namespace code represents the prefix, the bottom half represents the URI.
If the bottom half is zero, 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 -1.
For a node other than an element, the method returns null.
-
getAllNamespaces
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 classAbstractNodeWrapper
- Returns:
- the in-scope namespaces for an element, or null for any other kind of node.
-