*/
public class DataObject2OMElement extends BaseTransformer<DataObject, OMElement> implements
PullTransformer<DataObject, OMElement> {
public OMElement transform(DataObject source, TransformationContext context) {
HelperContext helperContext = SDOContextHelper.getHelperContext(context);
OMFactory factory = OMAbstractFactory.getOMFactory();
QName name = ROOT_ELEMENT;
if (context != null) {
DataType dataType = context.getTargetDataType();
Object logical = dataType == null ? null : dataType.getLogical();
if (logical instanceof XMLType) {
XMLType xmlType = (XMLType)logical;
if (xmlType.isElement()) {
name = xmlType.getElementName();
}
}
}
XMLDocument document = helperContext.getXMLHelper().createDocument(source,
name.getNamespaceURI(),
name.getLocalPart());
SDODataSource dataSource = new SDODataSource(document, helperContext);
OMElement element = AxiomHelper.createOMElement(factory, name, dataSource);
return element;