Class AxiomElementNodeWrapper

    • Field Detail

      • index

        protected int index
    • Constructor Detail

      • 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 wrapped
        docWrapper - The wrapper around the document node at the root of the tree
        parent - The NodeWrapper that wraps the parent of this node
        index - Position of this node among its siblings
    • Method Detail

      • getNodeKind

        public int getNodeKind()
        Return the type of node.
        Returns:
        one of the values Node.ELEMENT, Node.TEXT, Node.ATTRIBUTE, etc.
        See Also:
        Type
      • getSchemaType

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

        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())
      • 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.
      • getParent

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

        protected AxisIterator iterateAttributes​(NodeTest 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​(NodeTest 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.
      • getAttributeValue

        public java.lang.String getAttributeValue​(java.lang.String uri,
                                                  java.lang.String local)
        Get the string value of a given attribute of this node
        Specified by:
        getAttributeValue in interface NodeInfo
        Overrides:
        getAttributeValue in class AbstractNodeWrapper
        Parameters:
        uri - the namespace URI of the attribute name. Supply the empty string for an attribute that is in no namespace
        local - 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

        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
      • getDeclaredNamespaces

        public NamespaceBinding[] getDeclaredNamespaces​(NamespaceBinding[] buffer)
        Get all namespace undeclarations and undeclarations defined on this element.
        Specified by:
        getDeclaredNamespaces in interface NodeInfo
        Overrides:
        getDeclaredNamespaces in class AbstractNodeWrapper
        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

        public NamespaceMap 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 interface NodeInfo
        Overrides:
        getAllNamespaces in class AbstractNodeWrapper
        Returns:
        the in-scope namespaces for an element, or null for any other kind of node.