private CorbaTypeImpl processStruct(XmlSchemaComplexType complex, QName defaultName)
throws Exception {
QName name;
Struct corbaStruct = null;
QName schematypeName = checkPrefix(complex.getQName());
if (schematypeName == null) {
schematypeName = createQNameTargetNamespace(defaultName.getLocalPart());
if (defaultName.getNamespaceURI().equals("")) {
schematypeName = checkPrefix(schematypeName);
} else {
schematypeName = checkPrefix(defaultName);
}
name = checkPrefix(createQNameCorbaNamespace(defaultName.getLocalPart()));
} else {
name = checkPrefix(createQNameCorbaNamespace(schematypeName.getLocalPart()));
}
corbaStruct = (Struct)recursionMap.get(name);
if (corbaStruct != null) {
return corbaStruct;
}
corbaStruct = new Struct();
corbaStruct.setName(name.getLocalPart());
corbaStruct.setQName(name);
String repoId = REPO_STRING + name.getLocalPart().replace('.', '/') + IDL_VERSION;
corbaStruct.setRepositoryID(repoId);
corbaStruct.setType(schematypeName);
recursionMap.put(name, corbaStruct);
if (complex.getContentModel() instanceof XmlSchemaSimpleContent) {
corbaStruct = processSimpleContentStruct((XmlSchemaSimpleContent)complex.getContentModel(),
defaultName, corbaStruct, schematypeName);
} else if (complex.getContentModel() instanceof XmlSchemaComplexContent) {
corbaStruct = processComplexContentStruct((XmlSchemaComplexContent)complex.getContentModel(),
defaultName, corbaStruct, schematypeName);
}
// Process attributes at ComplexType level
if (!complex.getAttributes().isEmpty()) {
String uri;
if (schematypeName != null) {
uri = schematypeName.getNamespaceURI();
} else {
uri = defaultName.getNamespaceURI();
}
List attlist2 = processAttributesAsMembers(complex.getAttributes(), uri);
for (int i = 0; i < attlist2.size(); i++) {
MemberType member = (MemberType)attlist2.get(i);
corbaStruct.getMember().add(member);
}
}
if (complex.getParticle() != null) {
List members = processContainerAsMembers(complex.getParticle(), defaultName, schematypeName);
for (Iterator it = members.iterator(); it.hasNext();) {
MemberType memberType = (MemberType)it.next();
corbaStruct.getMember().add(memberType);
}
}
recursionMap.remove(name);