Package app.tozzi.util
Class XMLUtils
java.lang.Object
app.tozzi.util.XMLUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute(Document doc, String path, String attributeName) Extracts attribute value fromDocumentgetTextAndAttribute(Document document, String path, String attribute) Extracts text content and node value of attribute fromDocumentgetTextContent(Document document, String path) Extracts text content fromDocument
-
Constructor Details
-
XMLUtils
public XMLUtils()
-
-
Method Details
-
getAttribute
public static Optional<String> getAttribute(Document doc, String path, String attributeName) throws XPathExpressionException Extracts attribute value fromDocument- Parameters:
doc- documentpath- pathattributeName- attribute- Returns:
- attribute value
- Throws:
XPathExpressionException
-
getTextAndAttribute
public static Map<String,String> getTextAndAttribute(Document document, String path, String attribute) throws XPathExpressionException Extracts text content and node value of attribute fromDocument- Parameters:
document- documentpath- pathattribute- attribute- Returns:
- text and attribute
- Throws:
XPathExpressionException
-
getTextContent
public static Optional<String> getTextContent(Document document, String path) throws XPathExpressionException Extracts text content fromDocument- Parameters:
document- documentpath- path- Returns:
- text attribute
- Throws:
XPathExpressionException
-