XmlSchemaSequence sequence = new XmlSchemaSequence();
complexType.setParticle(sequence);
// corba:struct
Struct struct = new Struct();
struct.setQName(new QName(typeMap.getTargetNamespace(), structScope.toString()));
struct.setType(complexType.getQName());
struct.setRepositoryID(structScope.toIDLRepositoryID());
// struct members
AST memberTypeNode = identifierNode.getNextSibling();
while (memberTypeNode != null) {
AST memberNode = TypesUtils.getCorbaTypeNameNode(memberTypeNode);
XmlSchemaType schemaType = null;
CorbaTypeImpl corbaType = null;
try {
TypesVisitor visitor = new TypesVisitor(structScope,
schemas,
schema,
typeMap,
null);
visitor.visit(memberTypeNode);
schemaType = visitor.getSchemaType();
corbaType = visitor.getCorbaType();
} catch (Exception ex) {
System.out.println(ex.getMessage());
System.exit(1);
}
// needed for anonymous arrays in structs
if (ArrayVisitor.accept(memberNode)) {
Scope anonScope = new Scope(structScope,
TypesUtils.getCorbaTypeNameNode(memberTypeNode));
ArrayVisitor arrayVisitor = new ArrayVisitor(anonScope,
schemas,
schema,
typeMap,
schemaType,
corbaType,
null);
arrayVisitor.visit(memberNode);
schemaType = arrayVisitor.getSchemaType();
corbaType = arrayVisitor.getCorbaType();
}
// xmlschema:member
XmlSchemaElement member = new XmlSchemaElement();
String memberName = memberNode.toString();
member.setName(memberName);
member.setSchemaType(schemaType);
member.setSchemaTypeName(schemaType.getQName());
sequence.getItems().add(member);
// corba:member
MemberType memberType = new MemberType();
memberType.setName(memberName);
memberType.setIdltype(corbaType.getQName());
struct.getMember().add(memberType);
memberTypeNode = memberNode.getNextSibling();
}
// add schemaType