xmlRec.setLeafElementType(xmlFld.getLastXPathFragment().getLeafElementType());
}
XMLRecord parent = (XMLRecord) databaseRow;
if (xmlReferenceDescriptor != null) {
XMLObjectBuilder objectBuilder = (XMLObjectBuilder) xmlReferenceDescriptor.getObjectBuilder();
boolean addXsiType = shouldAddXsiType((XMLRecord) databaseRow, xmlReferenceDescriptor);
XMLRecord child = (XMLRecord) objectBuilder.createRecordFor(attributeValue, (XMLField) getField(), parent, this);
child.setNamespaceResolver(parent.getNamespaceResolver());
objectBuilder.buildIntoNestedRow(child, attributeValue, session, addXsiType);
return child;
} else {
if (attributeValue instanceof Element && getKeepAsElementPolicy() == UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT) {
return new DOMRecord((Element) attributeValue);
}else{