Log log = getLog();
try {
ElementDescriptor currentDescriptor = getCurrentDescriptor();
if (currentDescriptor != null) {
if (currentDescriptor.isPolymorphic()) {
PolymorphicReferenceResolver resolver = getXMLIntrospector().getPolymorphicReferenceResolver();
result = resolver.resolveType(mapping, this);
if (result == null) {
// try the other polymorphic descriptors
ElementDescriptor parent = getParentDescriptor();
if (parent != null) {
ElementDescriptor[] descriptors = parent.getElementDescriptors();
ElementDescriptor originalDescriptor = mapping.getDescriptor();
boolean resolved = false;
for (int i=0; i<descriptors.length;i++) {
ElementDescriptor descriptor = descriptors[i];
if (descriptor.isPolymorphic()) {
mapping.setDescriptor(descriptor);
result = resolver.resolveType(mapping, this);
if (result != null) {
resolved = true;
descriptorStack.pop();
popOptions();
descriptorStack.push(descriptor);