return buildIntoNestedRow(row, object, session, false);
}
public AbstractRecord buildIntoNestedRow(AbstractRecord row, Object object, AbstractSession session, boolean shouldWriteXsiType) {
// PERF: Avoid synchronized enumerator as is concurrency bottleneck.
XMLRecord record = (XMLRecord)row;
record.setSession(session);
XMLMarshaller marshaller = record.getMarshaller();
if ((marshaller != null) && (marshaller.getMarshalListener() != null)) {
marshaller.getMarshalListener().beforeMarshal(object);
}
List extraNamespaces = null;
if (isXmlDescriptor()) {
XMLDescriptor xmlDescriptor = (XMLDescriptor)getDescriptor();
extraNamespaces = addExtraNamespacesToNamespaceResolver(xmlDescriptor, record, session);
writeExtraNamespaces(extraNamespaces, record);
}
writeOutMappings(record, object, session);
// If this descriptor is involved in inheritance add the class type.
if (isXmlDescriptor()) {
XMLDescriptor xmlDescriptor = (XMLDescriptor)getDescriptor();
XMLSchemaReference xmlRef = xmlDescriptor.getSchemaReference();
if (shouldWriteXsiType) {
writeXsiTypeAttribute(xmlDescriptor, (DOMRecord)record, xmlRef.getSchemaContext().substring(1));
}
if (getDescriptor().hasInheritance()) {
if ((record.getLeafElementType() != null) && ((xmlRef.getType() == 1) && xmlRef.isGlobalDefinition())) {
// only interested in global COMPLEX_TYPE
QName ctxQName = xmlRef.getSchemaContextAsQName(xmlDescriptor.getNamespaceResolver());
if (ctxQName.equals(record.getLeafElementType())) {
// don't write out xsi:type attribute
} else {
// write out the target descriptor's schema context as xsi:type
XMLField xmlField = (XMLField)xmlDescriptor.getInheritancePolicy().getClassIndicatorField();
if (xmlField.getLastXPathFragment().isAttribute()) {