}
} else {
// conversion must be defined by mapping
MappingElementBase mapping;
if (refname == null) {
// complex type reference translates to abstract mapping in binding
mapping = (MappingElementBase)complexTypeMap.get(typename);
if (mapping == null) {
throw new RuntimeException("Cannot unwrap element " +
qname + ": no abstract mapping definition found for type " +
typename + " (used by element " + itemname + ')');
}
Integer tindex = (Integer)typeMappedClassMap.get(typename);
if (tindex == null) {
tindex = new Integer(typeMappedClassMap.size());
typeMappedClassMap.put(typename, tindex);
}
param.setAttribute("type-index", tindex.toString());
} else {
// element reference translates to concrete mapping
mapping = (MappingElementBase)elementMap.get(refname);
if (mapping == null) {
throw new RuntimeException("Cannot unwrap element " +
qname + ": no concrete mapping definition found for element " +
refname + " (used by element " + itemname + ')');
}
param.setAttribute("type-index", "");
}
// configure based on the mapping information
param.setAttribute("form", "complex");
complex = true;
javatype = mapping.getClassName();
createtype = mapping.getCreateType();
if (createtype == null && mapping.isAbstract() &&
mapping.getExtensionTypes().isEmpty()) {
// abstract mapping with no extensions requires instance
// this assumes the mapped type can be created, but no easy way to check
createtype = javatype;
}
// merge contained namespace definitions into set for operation
Iterator citer = mapping.topChildIterator();
while (citer.hasNext()) {
ElementBase child = (ElementBase)citer.next();
if (child.type() == ElementBase.NAMESPACE_ELEMENT) {
dfltns = mapNamespace((NamespaceElement)child, dfltns, nsmap);
} else {