targetNamespacePrefixMap.put(targetNameSpace, targetNamespacePrefix);
}
XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema, false);
XmlSchemaSequence sequence = new XmlSchemaSequence();
XmlSchemaComplexContentExtension complexExtension =
new XmlSchemaComplexContentExtension();
schemaTypeName = new QName(targetNameSpace, simpleName, targetNamespacePrefix);
Class<?> sup = javaType.getSuperclass();
if ((sup != null)
&& (!"java.lang.Object".equals(sup.getName()))
&& (!"java.lang.Exception".equals(sup.getName()))
&& !getQualifiedName(sup.getPackage()).startsWith("org.apache.axis2")
&& !getQualifiedName(sup.getPackage()).startsWith("java.util")){
String superClassName = sup.getName();
String superclassname = getSimpleClassName(sup);
String tgtNamespace;
String tgtNamespacepfx;
QName qName = typeTable.getSimpleSchemaTypeName(superClassName);
if (qName != null) {
tgtNamespace = qName.getNamespaceURI();
tgtNamespacepfx = qName.getPrefix();
} else {
tgtNamespace = resolveSchemaNamespace(getQualifiedName(sup.getPackage()));
tgtNamespacepfx = targetNamespacePrefixMap.get(tgtNamespace);
QName superClassQname = generateSchema(sup);
if (superClassQname != null) {
tgtNamespacepfx = superClassQname.getPrefix();
tgtNamespace = superClassQname.getNamespaceURI();
}
}
if (tgtNamespacepfx == null) {
tgtNamespacepfx = generatePrefix();
targetNamespacePrefixMap.put(tgtNamespace, tgtNamespacepfx);
}
//if the parent class package name is differ from the child
if (!((NamespaceMap) xmlSchema.getNamespaceContext()).values().
contains(tgtNamespace)) {
XmlSchemaImport importElement = new XmlSchemaImport(xmlSchema);
importElement.setNamespace(tgtNamespace);
xmlSchema.getItems().add(importElement);
((NamespaceMap) xmlSchema.getNamespaceContext()).
put(generatePrefix(), tgtNamespace);
}
QName basetype = new QName(tgtNamespace, superclassname, tgtNamespacepfx);
complexExtension.setBaseTypeName(basetype);
complexExtension.setParticle(sequence);
XmlSchemaComplexContent contentModel = new XmlSchemaComplexContent();
contentModel.setContent(complexExtension);
complexType.setContentModel(contentModel);
} else {