class XmlUtilsImpl implements XmlUtils {

    @Override
    public String getPathNodeText(Node parentNode, String path, boolean allowNone) throws
            XPathExpressionException, XmlSearchException
    {
        Node subNode = (Node) xPath.evaluate(path, parentNode, XPathConstants.NODE);
        if (subNode != null)
        {
            return subNode.getTextContent();
        }
        if(allowNone)
        {
            return null;
        }
        throw new XmlSearchException(String.format("Failed to find subnode: %1$s", path));
    }

}