class XMLUtil extends AbstractCaller {

    @Description("Returns a value of node by xpath.<br>" +
            "<b>content</b> - xml document<br>" +
            "<b>xpath</b> - path to node<br>" +
            "Example:<br/>" +
            "#{getObjectByXPath(content, xpath)}")
    @UtilityMethod
    public String getValueByXPath(String content, String xpath) {
        NodeList nodes = getNodesByXPath(content, xpath);
        if (nodes.getLength() != 1 || !hasOnlyTextNode(nodes.item(0))) {
            throw new EPSCommonException("The node has child nodes." + System.lineSeparator() + nodeToString(nodes.item(0)));
        }
        return nodes.item(0).getTextContent();
    }

}