AST typeNode = null;
AST nameNode = null;
AST labelNode = null;
// xmlschema:element
XmlSchemaElement element = new XmlSchemaElement();
// corba:unionbranch
Unionbranch unionBranch = new Unionbranch();
if (caseNode.getType() == IDLTokenTypes.LITERAL_default) {
// default:
unionBranch.setDefault(true);
typeNode = caseNode.getFirstChild();
nameNode = typeNode.getNextSibling();
} else {
// case:
createCase(caseNode, unionBranch);
labelNode = caseNode.getFirstChild();
if (labelNode.getType() == IDLTokenTypes.LITERAL_case) {
labelNode = labelNode.getNextSibling();
}
typeNode = labelNode.getNextSibling();
nameNode = typeNode.getNextSibling();
}
TypesVisitor visitor = new TypesVisitor(scope,
schemas,
schema,
typeMap,
null);
visitor.visit(typeNode);
XmlSchemaType stype = visitor.getSchemaType();
CorbaTypeImpl ctype = visitor.getCorbaType();
// needed for anonymous arrays in unions
if (ArrayVisitor.accept(nameNode)) {
Scope anonScope = new Scope(scope, TypesUtils.getCorbaTypeNameNode(nameNode));
ArrayVisitor arrayVisitor = new ArrayVisitor(anonScope,
schemas,
schema,
typeMap,
stype,
ctype,
null);
arrayVisitor.visit(nameNode);
stype = arrayVisitor.getSchemaType();
ctype = arrayVisitor.getCorbaType();
}
// xmlschema:element
element.setName(nameNode.toString());
element.setSchemaTypeName(stype.getQName());
choice.getItems().add(element);
// corba:unionbranch
unionBranch.setName(nameNode.toString());