Class DefaultDOMDocument

  • All Implemented Interfaces:
    DOMDocument

    public class DefaultDOMDocument
    extends Object
    implements DOMDocument
    This class wraps the DOM document.
    Author:
    Michele Mostarda (mostarda@fbk.eu), Davide Palmisano (palmisano@fbk.eu)
    • Constructor Detail

      • DefaultDOMDocument

        public DefaultDOMDocument​(URI documentIRI,
                                  Document document)
    • Method Detail

      • getNodes

        public List<Node> getNodes​(String xPath)
        Description copied from interface: DOMDocument
        Returns the list of nodes addressed by the given XPath.
        Specified by:
        getNodes in interface DOMDocument
        Parameters:
        xPath - a valid XPath
        Returns:
        a not null list of nodes.
      • getNode

        public Node getNode​(String xPath)
        Description copied from interface: DOMDocument
        Returns the node addressed by the given XPath, if more then one an exception will be raised.
        Specified by:
        getNode in interface DOMDocument
        Parameters:
        xPath - a valid XPath.
        Returns:
        a node or null if nothing found.
      • addAttribute

        public void addAttribute​(String xPath,
                                 String attrName,
                                 String attrValue)
        Description copied from interface: DOMDocument
        Adds an attribute to a node addressed by the given XPath.
        Specified by:
        addAttribute in interface DOMDocument
        Parameters:
        xPath - the XPath pointing the node.
        attrName - the name of the attribute.
        attrValue - the value of the attribute.
      • getNodesWithAttribute

        public List<Node> getNodesWithAttribute​(String attrName)
        Description copied from interface: DOMDocument
        Returns all the nodes declaring an attribute with the specified name.
        Specified by:
        getNodesWithAttribute in interface DOMDocument
        Parameters:
        attrName - name of attribute to use for filtering.
        Returns:
        a list of nodes. null if no matches found.