class SDNCRequestTasks {

    protected String getXmlElement(Document doc, String exp) throws Exception {
        TransformerFactory tf = TransformerFactory.newInstance();
        Transformer transformer = tf.newTransformer();
        StringWriter writer = new StringWriter();
        transformer.transform(new DOMSource(doc), new StreamResult(writer));
        logger.debug(writer.getBuffer().toString());
        XPath xPath = XPathFactory.newInstance().newXPath();
        String result = xPath.evaluate(exp, doc);
        if (result == null || result.isEmpty()) {
            throw new Exception("XPath Failed to find element expression: " + exp);
        }
        return result;
    }

}