Package net.sf.saxon.option.axiom

## Class AxiomDocumentNodeWrapper

- java.lang.Object
- - net.sf.saxon.tree.wrapper.AbstractNodeWrapper
  - - net.sf.saxon.option.axiom.AxiomParentNodeWrapper
    - - net.sf.saxon.option.axiom.AxiomDocumentNodeWrapper

- All Implemented Interfaces:
    `javax.xml.transform.Source`, `javax.xml.transform.SourceLocator`, `GroundedValue`, `Item`, `NodeInfo`, `Sequence`, `Location`, `SiblingCountingNode`, `VirtualNode`, `org.xml.sax.Locator`

      public class AxiomDocumentNodeWrapper
      extends AxiomParentNodeWrapper

  The document node in an AXIOM tree

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `protected static class` | `AxiomDocumentNodeWrapper.FollowingSiblingIterator` |
    `protected static class` | `AxiomDocumentNodeWrapper.PrecedingSiblingIterator` |

    - ### Nested 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

      `node`

    - ### Fields inherited from class net.sf.saxon.tree.wrapper.AbstractNodeWrapper

      `treeInfo`

    - ### Fields inherited from interface net.sf.saxon.om.NodeInfo

      `IS_DTD_TYPE, IS_NILLED`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `AxiomDocumentNodeWrapper​(org.apache.axiom.om.OMDocument root, java.lang.String baseURI, Configuration config)` | Create a Saxon wrapper for an Axiom document node

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `compareOrder​(NodeInfo other)` | Determine the relative position of this node and another node, in document order.
    `boolean` | `equals​(java.lang.Object other)` | Determine whether this is the same node as another node.
    `java.lang.String` | `getBaseURI()` | Get the Base URI for the node, that is, the URI used for resolving a relative URI contained in the node.
    `java.lang.String` | `getDisplayName()` | Get the display name of this node.
    `java.lang.String` | `getLocalPart()` | Get the local part of the name of this node.
    `int` | `getNodeKind()` | Get the kind of node.
    `NodeInfo` | `getParent()` | Get the NodeInfo object representing the parent of this node
    `java.lang.String` | `getPrefix()` | Get the prefix of the name of the node.
    `NodeInfo` | `getRoot()` | Get the root node of the tree containing this node
    `int` | `getSiblingPosition()` | Get the index position of this node among its siblings (starting from 0)
    `java.lang.String` | `getSystemId()` | Get the System ID for the node.
    `java.lang.String` | `getURI()` | Get the URI part of the name of this node.
    `boolean` | `isTyped()` | Ask whether the document contains any nodes whose type annotation is anything other than UNTYPED
    `protected AxisIterator` | `iterateAttributes​(java.util.function.Predicate<? super NodeInfo> nodeTest)` | Return an iterator over the attributes of this element node.
    `protected AxisIterator` | `iterateSiblings​(java.util.function.Predicate<? super NodeInfo> nodeTest, boolean forwards)` | Return an iterator over the siblings of this node.
    `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.
    `void` | `setSystemId​(java.lang.String systemId)` | Set the system identifier for this Source.

    - ### Methods inherited from class net.sf.saxon.option.axiom.AxiomParentNodeWrapper

      `atomize, generateId, getStringValueCS, getUnderlyingNode, hasChildNodes, iterateChildren, iterateDescendants`

    - ### Methods inherited from class net.sf.saxon.tree.wrapper.AbstractNodeWrapper

      `getAllNamespaces, getAttributeValue, getColumnNumber, getDeclaredNamespaces, getFingerprint, getLineNumber, getNamePool, getRealNode, getStringValue, getTreeInfo, hasFingerprint, hashCode, iterateAxis, iterateAxis, saveLocation`

    - ### 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, head, itemAt, iterate, reduce, subsequence`

    - ### Methods inherited from interface net.sf.saxon.s9api.Location

      `saveLocation`

    - ### Methods inherited from interface net.sf.saxon.om.NodeInfo

      `attributes, children, children, copy, getAllNamespaces, getAttributeValue, getColumnNumber, getConfiguration, getDeclaredNamespaces, getFingerprint, getGenre, getLineNumber, getPublicId, getSchemaType, getStringValue, getTreeInfo, hasFingerprint, hashCode, isId, isIdref, isNilled, isSameNodeInfo, isStreamed, iterateAxis, iterateAxis, toShortString`

    - ### Methods inherited from interface net.sf.saxon.om.Sequence

      `makeRepeatable`

    - ### Methods inherited from interface javax.xml.transform.Source

      `isEmpty`

- - ### Constructor Detail

    - #### AxiomDocumentNodeWrapper

          public AxiomDocumentNodeWrapper​(org.apache.axiom.om.OMDocument root,
                                          java.lang.String baseURI,
                                          Configuration config)

      Create a Saxon wrapper for an Axiom document node
      Parameters:
        `root` - The Axiom root node
        `baseURI` - The base URI for all the nodes in the tree
        `config` - The configuration which defines the name pool used for all names in this tree

  - ### Method Detail

    - #### 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 node
        `parent` - 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 as `Type.ELEMENT` or `Type.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:
        `Type`

    - #### equals

          public boolean equals​(java.lang.Object other)

      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:
        `equals` in interface `NodeInfo`
      Overrides:
        `equals` in class `AbstractNodeWrapper`
      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

          public java.lang.String getBaseURI()

      Get the Base URI for the node, that is, the URI used for resolving a relative URI contained in the node.
      Specified by:
        `getBaseURI` in interface `NodeInfo`
      Overrides:
        `getBaseURI` in class `AbstractNodeWrapper`
      Returns:
        the base URI of the node, taking into account xml:base attributes if present

    - #### getSystemId

          public java.lang.String 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:
        `getSystemId` in interface `Location`
      Specified by:
        `getSystemId` in interface `org.xml.sax.Locator`
      Specified by:
        `getSystemId` in interface `NodeInfo`
      Specified by:
        `getSystemId` in interface `javax.xml.transform.Source`
      Specified by:
        `getSystemId` in interface `javax.xml.transform.SourceLocator`
      Overrides:
        `getSystemId` in class `AbstractNodeWrapper`
      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

          public void setSystemId​(java.lang.String systemId)

      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:
        `setSystemId` in interface `javax.xml.transform.Source`
      Overrides:
        `setSystemId` in class `AbstractNodeWrapper`
      Parameters:
        `systemId` - The system identifier as a URL string.

    - #### getParent

          public NodeInfo 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

          public java.lang.String 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

          public java.lang.String 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.

    - #### getURI

          public java.lang.String getURI()

      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

          public java.lang.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:
        `getDisplayName` in interface `NodeInfo`
      Overrides:
        `getDisplayName` in class `AbstractNodeWrapper`
      Returns:
        The display name of this node. For a node with no name, return an empty string.

    - #### getRoot

          public NodeInfo getRoot()

      Get the root node of the tree containing this node
      Specified by:
        `getRoot` in interface `NodeInfo`
      Overrides:
        `getRoot` in class `AbstractNodeWrapper`
      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

          protected AxisIterator iterateAttributes​(java.util.function.Predicate<? super NodeInfo> nodeTest)

      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 class `AbstractNodeWrapper`
      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

          protected AxisIterator iterateSiblings​(java.util.function.Predicate<? super NodeInfo> nodeTest,
                                                 boolean forwards)

      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 class `AbstractNodeWrapper`
      Parameters:
        `nodeTest` - a test that the returned siblings must satisfy
        `forwards` - true for following siblings, false for preceding siblings
      Returns:
        an iterator over the sibling nodes, in axis order.

    - #### compareOrder

          public int compareOrder​(NodeInfo other)

      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())