Object objVal = buildObjectNoReferenceDescriptor(record, getConverter(), session, next, null, null);
// wrap the object in an XMLRoot
// if we know the descriptor use it to wrap the Element in an XMLRoot (if necessary)
if (referenceDescriptor != null) {
objVal = ((XMLDescriptor) referenceDescriptor).wrapObjectInXMLRoot(objVal, next.getNamespaceURI(), next.getLocalName(), next.getPrefix(), false);
cp.addInto(objVal, container, session);
} else {
// no descriptor, so manually build the XMLRoot
cp.addInto(buildXMLRoot(next, objVal), container, session);
}
}