{
vars.addAll(createVARsforXSModelGroup((XSModelGroup)xsterm, schema, origType));
return vars;
}
XSElementDeclaration elem = (XSElementDeclaration)xsterm;
// TODO: Check if the element contains any anon complex type
// TODO: If yes, create class that is ComplexTypeName+ElementName
// TODO: ItemsItem If the elem contains anon simpletype
// TODO: No need to create seperate Java class
String tname = elem.getName();
XSTypeDefinition xstypedef = elem.getTypeDefinition();
String xstypename = xstypedef.getName();
// Check if it is a composite type
if (xstypename != null && xstypedef.getName().equals(origType.getName()) && xstypedef.getNamespace().equals(origType.getNamespace()))
{
// it is a composite type
QName qn = new QName(origType.getNamespace(), origType.getName());
VAR vr = createVAR(qn, elem, (XSComplexTypeDefinition)xstypedef, tname, pkgname, arrayType);
vars.add(vr);
return vars;
}
else
if (xstypename == null && xstypedef instanceof XSComplexTypeDefinition)
{
XSComplexTypeDefinition xsc = (XSComplexTypeDefinition)xstypedef;
String subname = utils.firstLetterUpperCase(tname);
// Save the fname in a temp var
String tempfname = this.fname;
// it will be an anonymous type
if (containingElement == null || containingElement.length() == 0)
containingElement = origType.getName();
String anonName;
if (elem.getScope() == XSConstants.SCOPE_GLOBAL)
{
anonName = subname;
}
else
{
anonName = containingElement + subname;
}
anonName = utils.firstLetterUpperCase(anonName);
this.fname = anonName;
if (!generatedFiles.contains(this.fname))
{
generatedFiles.add(this.fname);
this.createJavaFile((XSComplexTypeDefinition)xstypedef, schema, false);
}
// Restore the fname
this.fname = tempfname;
// Bypass rest of processing
QName anonqn = new QName(anonName);
VAR vr = createVAR(anonqn, elem, xsc, tname, pkgname, arrayType);
vars.add(vr);
return vars;
}
else
{
String temp = this.fname;
// Unwrap any array wrappers
if (SchemaUtils.isWrapperArrayType(xstypedef))
{
XSComplexTypeDefinition complex = (XSComplexTypeDefinition)xstypedef;
XSModelGroup group = (XSModelGroup)complex.getParticle().getTerm();
XSElementDeclaration element = (XSElementDeclaration)((XSParticle)group.getParticles().item(0)).getTerm();
xstypedef = element.getTypeDefinition();
xstypename = xstypedef.getName();
arrayType = true;
}
QName qn = null;