java.lang.Object
com.github.ferstl.maven.pomenforcers.util.XmlUtils

public final class XmlUtils extends Object
  • Method Details

    • parseXml

      public static Document parseXml(File file)
      Parses the given file into an XML Document.
      Parameters:
      file - The file to parse.
      Returns:
      The created XML Document.
    • evaluateXPathAsElement

      public static Element evaluateXPathAsElement(String expression, Document document)
      Returns the XML Element matching the given XPath expression.
      Parameters:
      expression - XPath expression.
      document - XML document to search for the element.
      Returns:
      The matching XML Element.
    • evaluateXPathAsNodeList

      public static NodeList evaluateXPathAsNodeList(String expression, Document document)
      Returns the XML NodeList matching the given XPath expression.
      Parameters:
      expression - XPath expression.
      document - XML document to search for the node list.
      Returns:
      The matching XML NodeList.
    • createDocument

      public static Document createDocument(String root, NodeList content)
      Creates a XML document with the given root element and the given NodeList as content.
      Parameters:
      root - The root element of the XML document.
      content - Content of the XML document.
      Returns:
      The created XML document.