Class AxiomDocumentNodeWrapper
- All Implemented Interfaces:
Source,SourceLocator,ActiveSource,GroundedValue,Item,NodeInfo,Sequence,Location,SiblingCountingNode,VirtualNode,Locator
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected static classNested classes/interfaces inherited from class net.sf.saxon.option.axiom.AxiomParentNodeWrapper
AxiomParentNodeWrapper.ChildWrappingIterator, AxiomParentNodeWrapper.DescendantWrappingIterator -
Field Summary
Fields inherited from class net.sf.saxon.option.axiom.AxiomParentNodeWrapper
nodeFields inherited from class net.sf.saxon.tree.wrapper.AbstractNodeWrapper
treeInfo -
Constructor Summary
ConstructorsConstructorDescriptionAxiomDocumentNodeWrapper(org.apache.axiom.om.OMDocument root, String baseURI, Configuration config) Create a Saxon wrapper for an Axiom document node -
Method Summary
Modifier and TypeMethodDescriptionintcompareOrder(NodeInfo other) Determine the relative position of this node and another node, in document order.booleanDetermine whether this is the same node as another node.Get the Base URI for the node, that is, the URI used for resolving a relative URI contained in the node.Get the display name of this node.Get the local part of the name of this node.Get the URI part of the name of this node.intGet the kind 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 nodeintGet the index position of this node among its siblings (starting from 0)Get the System ID for the node.booleanisTyped()Ask whether the document contains any nodes whose type annotation is anything other than UNTYPEDprotected AxisIteratoriterateAttributes(NodeTest nodeTest) Return an iterator over the attributes of this element node.protected AxisIteratoriterateSiblings(NodeTest nodeTest, boolean forwards) Return an iterator over the siblings of this node.protected static NodeInfomakeWrapper(org.apache.axiom.om.OMNode node, AxiomDocument docWrapper, AxiomParentNodeWrapper parent, int index) Factory method to wrap an Axiom node with a wrapper that implements the Saxon NodeInfo interface.voidsetSystemId(String systemId) Set the system identifier for this Source.Methods inherited from class net.sf.saxon.option.axiom.AxiomParentNodeWrapper
atomize, generateId, getUnderlyingNode, getUnicodeStringValue, hasChildNodes, iterateChildren, iterateDescendantsMethods inherited from class net.sf.saxon.tree.wrapper.AbstractNodeWrapper
getAllNamespaces, getAttributeValue, getColumnNumber, getDeclaredNamespaces, getFingerprint, getLineNumber, getNamePool, getRealNode, getTreeInfo, hasFingerprint, hashCode, iterateAxis, iterateAxis, saveLocationMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.sf.saxon.om.GroundedValue
asIterable, concatenate, containsNode, effectiveBooleanValue, materializeMethods inherited from interface net.sf.saxon.om.Item
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, copy, deliver, getAllNamespaces, getAttributeValue, getAttributeValue, getColumnNumber, getConfiguration, getDeclaredNamespaces, getFingerprint, getGenre, getLineNumber, getPublicId, getSchemaType, getTreeInfo, getURI, hasFingerprint, hashCode, isId, isIdref, isNilled, isSameNodeInfo, isStreamed, iterateAxis, iterateAxis, toShortStringMethods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
Constructor Details
-
AxiomDocumentNodeWrapper
public AxiomDocumentNodeWrapper(org.apache.axiom.om.OMDocument root, String baseURI, Configuration config) Create a Saxon wrapper for an Axiom document node- Parameters:
root- The Axiom root nodebaseURI- The base URI for all the nodes in the treeconfig- The configuration which defines the name pool used for all names in this tree
-
-
Method Details
-
makeWrapper
protected static NodeInfo makeWrapper(org.apache.axiom.om.OMNode node, AxiomDocument docWrapper, AxiomParentNodeWrapper parent, int index) Factory method to wrap an Axiom node with a wrapper that implements the Saxon NodeInfo interface.- Parameters:
node- The Axiom node (an element, text, processing-instruction, or comment node)docWrapper- The wrapper for the Document containing this nodeparent- The wrapper for the parent of the Axiom node. May be null if not known.index- The position of this node relative to its siblings. May be -1 if not known- Returns:
- The new wrapper for the supplied node
-
isTyped
public boolean isTyped()Ask whether the document contains any nodes whose type annotation is anything other than UNTYPED- Returns:
- true if the document contains elements whose type is other than UNTYPED
-
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.
-
getNodeKind
public int getNodeKind()Get the kind of node. This will be a value such asType.ELEMENTorType.ATTRIBUTE. There are seven kinds of node: documents, elements, attributes, text, comments, processing-instructions, and namespaces.- Returns:
- an integer identifying the kind of node. These integer values are the same as those used in the DOM
- Since:
- 8.4
- See Also:
-
equals
Determine whether this is the same node as another node.Note that two different NodeInfo instances can represent the same conceptual node. Therefore the "==" operator should not be used to test node identity. The equals() method should give the same result as isSameNodeInfo(), but since this rule was introduced late it might not apply to all implementations.
Note: a.isSameNodeInfo(b) if and only if generateId(a)==generateId(b).
This method has the same semantics as isSameNode() in DOM Level 3, but works on Saxon NodeInfo objects rather than DOM Node objects.
- Specified by:
equalsin interfaceNodeInfo- Overrides:
equalsin classAbstractNodeWrapper- Parameters:
other- the node to be compared with this node- Returns:
- true if this NodeInfo object and the supplied NodeInfo object represent the same node in the tree.
-
getBaseURI
Get the Base URI for the node, that is, the URI used for resolving a relative URI contained in the node.- Specified by:
getBaseURIin interfaceNodeInfo- Overrides:
getBaseURIin classAbstractNodeWrapper- Returns:
- the base URI of the node, taking into account xml:base attributes if present
-
getSystemId
Get the System ID for the node. Note this is not the same as the base URI: the base URI can be modified by xml:base, but the system ID cannot. The base URI is used primarily for resolving relative URIs within the content of the document. The system ID is used primarily in conjunction with a line number, for identifying the location of elements within the source XML, in particular when errors are found. For a document node, the System ID represents the value of the document-uri property as defined in the XDM data model.- Specified by:
getSystemIdin interfaceLocation- Specified by:
getSystemIdin interfaceLocator- Specified by:
getSystemIdin interfaceNodeInfo- Specified by:
getSystemIdin interfaceSource- Specified by:
getSystemIdin interfaceSourceLocator- Overrides:
getSystemIdin classAbstractNodeWrapper- Returns:
- the System Identifier of the entity in the source document containing the node, or null if not known or not applicable.
- Since:
- 8.4
-
setSystemId
Set the system identifier for this Source.The system identifier is optional if the source does not get its data from a URL, but it may still be useful to provide one. The application can use a system identifier, for example, to resolve relative URIs and to include in error messages and warnings.
- Specified by:
setSystemIdin interfaceNodeInfo- Specified by:
setSystemIdin interfaceSource- Overrides:
setSystemIdin classAbstractNodeWrapper- Parameters:
systemId- The system identifier as a URL 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
-
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.
-
getDisplayName
Get the display name of this node. For elements and attributes this is [prefix:]localname. For unnamed nodes, it is an empty string.- Specified by:
getDisplayNamein interfaceNodeInfo- Overrides:
getDisplayNamein classAbstractNodeWrapper- Returns:
- The display name of this node. For a node with no name, return an empty string.
-
getRoot
Get the root node of the tree containing this node- Specified by:
getRootin interfaceNodeInfo- Overrides:
getRootin classAbstractNodeWrapper- Returns:
- the NodeInfo representing the top-level ancestor of this node. This will not necessarily be a document node. If this node has no parent, then the method returns this node.
- Since:
- 8.4
-
iterateAttributes
Description copied from class:AbstractNodeWrapperReturn an iterator over the attributes of this element node. This method is only called after checking that the node is an element.- Specified by:
iterateAttributesin 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:AbstractNodeWrapperReturn 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:
iterateSiblingsin 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.
-
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())
-