Class NodeOverNodeInfo

    • Constructor Detail

      • NodeOverNodeInfo

        public NodeOverNodeInfo()
    • Method Detail

      • getUnderlyingNodeInfo

        public NodeInfo getUnderlyingNodeInfo()
        Get the Saxon NodeInfo object representing this node
        Returns:
        the Saxon NodeInfo object
      • wrap

        public static NodeOverNodeInfo wrap​(NodeInfo node)
        Factory method to construct a DOM node that wraps an underlying Saxon NodeInfo
        Parameters:
        node - the Saxon NodeInfo object
        Returns:
        the DOM wrapper node
      • isSameNode

        public final boolean isSameNode​(Node other)
        Determine whether this is the same node as another node. DOM Level 3 method.
        Specified by:
        isSameNode in interface Node
        Returns:
        true if this Node object and the supplied Node object represent the same node in the tree.
      • equals

        public boolean equals​(Object obj)
        The equals() method returns true for two Node objects that represent the same conceptual DOM Node. This is a concession to the Xalan IdentityTransformer, which relies on equals() for DOM Nodes having this behaviour, even though it is not defined in the specification
        Overrides:
        equals in class Object
        Parameters:
        obj - the object to be compared
        Returns:
        if this node and obj represent the same conceptual DOM node. That is, return true if isSameNode((Node)obj) returns true
      • hashCode

        public int hashCode()
        Return a hashCode
        Overrides:
        hashCode in class Object
        Returns:
        a hashCode such that two wrappers over the same underlying node have the same hashCode.
      • getBaseURI

        public String getBaseURI()
        Get the base URI for the node. Default implementation for child nodes gets the base URI of the parent node.
        Specified by:
        getBaseURI in interface Node
      • getNodeName

        public String getNodeName()
        Get the name of this node, following the DOM rules
        Specified by:
        getNodeName in interface Node
        Returns:
        The name of the node. For an element this is the element name, for an attribute it is the attribute name, as a lexical QName. Other node types return conventional names such as "#text" or "#comment"
      • getLocalName

        public String getLocalName()
        Get the local name of this node, following the DOM rules
        Specified by:
        getLocalName in interface Node
        Returns:
        The local name of the node. For an element this is the local part of the element name, for an attribute it is the local part of the attribute name. Other node types return null.
      • hasChildNodes

        public boolean hasChildNodes()
        Determine whether the node has any children.
        Specified by:
        hasChildNodes in interface Node
        Returns:
        true if this node has any attributes, false otherwise.
      • hasAttributes

        public boolean hasAttributes()
        Returns whether this node has any attributes. We treat the declaration of the XML namespace as being present on every element, and since namespace declarations are treated as attributes, every element has at least one attribute. This method therefore returns true.
        Specified by:
        hasAttributes in interface Node
        Returns:
        true if this node has any attributes, false otherwise.
        Since:
        DOM Level 2
      • getNodeType

        public short getNodeType()
        Get the type of this node (node kind, in XPath terminology). Note, the numbers assigned to node kinds in Saxon (see Type) are the same as those assigned in the DOM
        Specified by:
        getNodeType in interface Node
      • getParentNode

        public Node getParentNode()
        Find the parent node of this node.
        Specified by:
        getParentNode in interface Node
        Returns:
        The Node object describing the containing element or root node.
      • getPreviousSibling

        public Node getPreviousSibling()
        Get the previous sibling of the node
        Specified by:
        getPreviousSibling in interface Node
        Returns:
        The previous sibling node. Returns null if the current node is the first child of its parent.
      • getNextSibling

        public Node getNextSibling()
        Get next sibling node
        Specified by:
        getNextSibling in interface Node
        Returns:
        The next sibling node. Returns null if the current node is the last child of its parent.
      • getFirstChild

        public Node getFirstChild()
        Get first child
        Specified by:
        getFirstChild in interface Node
        Returns:
        the first child node of this node, or null if it has no children
      • getLastChild

        public Node getLastChild()
        Get last child
        Specified by:
        getLastChild in interface Node
        Returns:
        last child of this node, or null if it has no children
      • getNodeValue

        public String getNodeValue()
        Get the node value (as defined in the DOM). This is not generally the same as the XPath string-value: in particular, the node value of an element node is null.
        Specified by:
        getNodeValue in interface Node
      • getChildNodes

        public NodeList getChildNodes()
        Return a NodeList that contains all children of this node. If there are no children, this is a NodeList containing no nodes.
        Specified by:
        getChildNodes in interface Node
      • getAttributes

        public NamedNodeMap getAttributes()
        Return a NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.
        Specified by:
        getAttributes in interface Node
      • getOwnerDocument

        public Document getOwnerDocument()
        Return the Document object associated with this node.
        Specified by:
        getOwnerDocument in interface Node
      • insertBefore

        public Node insertBefore​(Node newChild,
                                 Node refChild)
                          throws DOMException
        Insert the node newChild before the existing child node refChild. Always fails.
        Specified by:
        insertBefore in interface Node
        Parameters:
        newChild - The node to insert.
        refChild - The reference node, i.e., the node before which the new node must be inserted.
        Returns:
        The node being inserted.
        Throws:
        DOMException - NO_MODIFICATION_ALLOWED_ERR: Always raised.
      • replaceChild

        public Node replaceChild​(Node newChild,
                                 Node oldChild)
                          throws DOMException
        Replace the child node oldChild with newChild in the list of children, and returns the oldChild node. Always fails.
        Specified by:
        replaceChild in interface Node
        Parameters:
        newChild - The new node to put in the child list.
        oldChild - The node being replaced in the list.
        Returns:
        The node replaced.
        Throws:
        DOMException - NO_MODIFICATION_ALLOWED_ERR: Always raised.
      • removeChild

        public Node removeChild​(Node oldChild)
                         throws DOMException
        Remove the child node indicated by oldChild from the list of children, and returns it. Always fails.
        Specified by:
        removeChild in interface Node
        Parameters:
        oldChild - The node being removed.
        Returns:
        The node removed.
        Throws:
        DOMException - NO_MODIFICATION_ALLOWED_ERR: Always raised.
      • appendChild

        public Node appendChild​(Node newChild)
                         throws DOMException
        Adds the node newChild to the end of the list of children of this node. Always fails.
        Specified by:
        appendChild in interface Node
        Parameters:
        newChild - The node to add.
        Returns:
        The node added.
        Throws:
        DOMException -
        NO_MODIFICATION_ALLOWED_ERR: Always raised.
      • cloneNode

        public Node cloneNode​(boolean deep)
        Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. Always fails.
        Specified by:
        cloneNode in interface Node
        Parameters:
        deep - If true , recursively clone the subtree under the specified node; if false , clone only the node itself (and its attributes, if it is an Element ).
        Returns:
        The duplicate node.
      • normalize

        public void normalize()
        Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes.
        Specified by:
        normalize in interface Node
        Since:
        DOM Level 2
      • isSupported

        public boolean isSupported​(String feature,
                                   String version)
        Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.
        Specified by:
        isSupported in interface Node
        Parameters:
        feature - The name of the feature to test. This is the same name which can be passed to the method hasFeature on DOMImplementation .
        version - This is the version number of the feature to test. In Level 2, version 1, this is the string "2.0". If the version is not specified, supporting any version of the feature will cause the method to return true .
        Returns:
        Returns true if the specified feature is supported on this node, false otherwise.
        Since:
        DOM Level 2
      • getNamespaceURI

        public String getNamespaceURI()
        The namespace URI of this node, or null if it is unspecified.
        This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace URI given at creation time.
        For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always null . Per the Namespaces in XML Specification an attribute does not inherit its namespace from the element it is attached to. If an attribute is not explicitly given a namespace, it simply has no namespace.
        Specified by:
        getNamespaceURI in interface Node
        Since:
        DOM Level 2
      • getPrefix

        public String getPrefix()
        The namespace prefix of this node, or null if it is unspecified.
        For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always null.
        Specified by:
        getPrefix in interface Node
        Since:
        DOM Level 2
      • compareDocumentPosition

        public short compareDocumentPosition​(Node other)
                                      throws DOMException
        Compare the position of the (other) node in document order with the reference node (this node). DOM Level 3 method.
        Specified by:
        compareDocumentPosition in interface Node
        Parameters:
        other - the other node.
        Returns:
        Returns how the node is positioned relatively to the reference node.
        Throws:
        DOMException - if an error occurs
      • getTextContent

        public String getTextContent()
                              throws DOMException
        Get the text content of a node. This is a DOM Level 3 method. The definition is the same as the definition of the string value of a node in XPath, except in the case of document nodes.
        Specified by:
        getTextContent in interface Node
        Returns:
        the string value of the node, or null in the case of document nodes.
        Throws:
        DOMException - if a dynamic error occurs
      • lookupPrefix

        public String lookupPrefix​(String namespaceURI)
        Get the (first) prefix assigned to a specified namespace URI, or null if the namespace is not in scope. DOM Level 3 method.
        Specified by:
        lookupPrefix in interface Node
        Parameters:
        namespaceURI - the namespace whose prefix is required
        Returns:
        the corresponding prefix, if there is one, or null if not.
      • isDefaultNamespace

        public boolean isDefaultNamespace​(String namespaceURI)
        Test whether a particular namespace is the default namespace. DOM Level 3 method.
        Specified by:
        isDefaultNamespace in interface Node
        Parameters:
        namespaceURI - the namespace to be tested
        Returns:
        true if this is the default namespace
      • lookupNamespaceURI

        public String lookupNamespaceURI​(String prefix)
        Find the URI corresponding to a given in-scope prefix
        Specified by:
        lookupNamespaceURI in interface Node
        Parameters:
        prefix - The namespace prefix whose namespace URI is required.
        Returns:
        the corresponding namespace URI, or null if the prefix is not declared.
      • isEqualNode

        public boolean isEqualNode​(Node arg)
        Compare whether two nodes have the same content. This is a DOM Level 3 method.
        Specified by:
        isEqualNode in interface Node
        Parameters:
        arg - The node to be compared. This must wrap a Saxon NodeInfo.
        Returns:
        true if the two nodes are deep-equal.
      • getFeature

        public Object getFeature​(String feature,
                                 String version)
        Get a feature of this node. DOM Level 3 method, always returns null.
        Specified by:
        getFeature in interface Node
        Parameters:
        feature - the required feature
        version - the version of the required feature
        Returns:
        the value of the feature. Always null in this implementation
      • setUserData

        public Object setUserData​(String key,
                                  Object data,
                                  UserDataHandler handler)
        Set user data. Always throws UnsupportedOperationException in this implementation
        Specified by:
        setUserData in interface Node
        Parameters:
        key - name of the user data
        data - value of the user data
        handler - handler for the user data
        Returns:
        This implementation always throws an exception
      • getUserData

        public Object getUserData​(String key)
        Get user data associated with this node. DOM Level 3 method, always returns null in this implementation
        Specified by:
        getUserData in interface Node
        Parameters:
        key - identifies the user data required
        Returns:
        always null in this implementation
      • disallowUpdate

        protected static void disallowUpdate()
                                      throws DOMException
        Internal method used to indicate that update operations are not allowed
        Throws:
        DOMException - always, to indicate that update is not supported in this DOM implementation