Class XmlUtils
java.lang.Object
com.github.ferstl.maven.pomenforcers.util.XmlUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic DocumentcreateDocument(String root, NodeList content)Creates a XML document with the given root element and the givenNodeListas content.static ElementevaluateXPathAsElement(String expression, Document document)Returns the XMLElementmatching the given XPath expression.static NodeListevaluateXPathAsNodeList(String expression, Document document)Returns the XMLNodeListmatching the given XPath expression.static DocumentParses the given file into an XMLDocument.
-
Method Details
-
parseXml
Parses the given file into an XMLDocument.- Parameters:
file- The file to parse.- Returns:
- The created XML
Document.
-
evaluateXPathAsElement
Returns the XMLElementmatching the given XPath expression.- Parameters:
expression- XPath expression.document- XML document to search for the element.- Returns:
- The matching XML
Element.
-
evaluateXPathAsNodeList
Returns the XMLNodeListmatching the given XPath expression.- Parameters:
expression- XPath expression.document- XML document to search for the node list.- Returns:
- The matching XML
NodeList.
-
createDocument
Creates a XML document with the given root element and the givenNodeListas content.- Parameters:
root- The root element of the XML document.content- Content of the XML document.- Returns:
- The created XML document.
-