}
public NodeInfo transform(DataObject source, TransformationContext context) {
// FIXME: Need to create the HelperContext from the transformation context
// FIXME: This is a big hack to create a document using the class name
XMLHelper helper = XMLHelper.INSTANCE;
String name = null;
if (source.getClass().getInterfaces().length > 0) {
name = source.getClass().getInterfaces()[0].getSimpleName();
} else {
name = source.getClass().getName();
}
if (name.length() > 0) {
name = Character.toLowerCase(name.charAt(0)) + name.substring(1, name.length());
}
try {
DOMResult domResult = new DOMResult(DOMHelper.newDocument());
XMLDocument xmlDoc = helper.createDocument(source, null, name);
helper.save(xmlDoc, domResult, null);
return node2NodeInfoTransformer.transform(domResult.getNode(), context);
} catch (Exception e) {
throw new TransformationException(e);
}