if (source == null) {
return null;
}
try {
HelperContext helperContext = SDOContextHelper.getHelperContext(context, true);
XMLHelper xmlHelper = helperContext.getXMLHelper();
QName elementName = SDOContextHelper.getElement(context);
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
DOMResult result = new DOMResult(doc);
XMLDocument xmlDoc = xmlHelper.createDocument(source, elementName.getNamespaceURI(), elementName.getLocalPart());
xmlHelper.save(xmlDoc, result, null);
return doc.getDocumentElement();
} catch (Exception e) {
throw new TransformationException(e);
}
}