while (namesIterator.hasNext()) {
QName name = (QName)namesIterator.next();
XmlSchemaObject xmlSchemaObject = (XmlSchemaObject)schemaTypes.getItem(name);
if (xmlSchemaObject instanceof XmlSchemaComplexType) {
try {
XmlSchemaComplexType complexType = (XmlSchemaComplexType)xmlSchemaObject;
if (!JavascriptUtils.notVeryComplexType(complexType)
&& complexType.getName() != null) {
complexTypeConstructorAndAccessors(complexType.getQName(), complexType);
complexTypeSerializerFunction(complexType.getQName(), complexType);
domDeserializerFunction(complexType.getQName(), complexType);
}
} catch (UnsupportedConstruct usc) {
LOG.warning(usc.toString());
continue; // it could be empty, but the style checker
// would complain.
}
} else if (xmlSchemaObject instanceof XmlSchemaSimpleType) {
XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType)xmlSchemaObject;
if (XmlSchemaUtils.isEumeration(simpleType)) {
List<String> values = XmlSchemaUtils.enumeratorValues(simpleType);
code.append("//\n");
code.append("// Simple type (enumeration) " + simpleType.getQName() + "\n");
code.append("//\n");
for (String value : values) {
code.append("// - " + value + "\n");
}
}
}
}
// now add in global elements with anonymous types.
schemaTypes = schema.getElements();
namesIterator = schemaTypes.getNames();
while (namesIterator.hasNext()) {
QName name = (QName)namesIterator.next();
XmlSchemaObject xmlSchemaObject = (XmlSchemaObject)schemaTypes.getItem(name);
if (xmlSchemaObject instanceof XmlSchemaElement) { // the
// alternative
// is too wierd
// to
// contemplate.
try {
XmlSchemaElement element = (XmlSchemaElement)xmlSchemaObject;
if (element.getSchemaTypeName() == null && element.getSchemaType() == null) {
Message message = new Message("ELEMENT_MISSING_TYPE", LOG, element.getQName(),
element.getSchemaTypeName(),
schema.getTargetNamespace());
LOG.warning(message.toString());
continue;
}
XmlSchemaType type;
if (element.getSchemaType() != null) {
type = element.getSchemaType();
} else {
type = schema.getTypeByName(element.getSchemaTypeName());
}
if (!(type instanceof XmlSchemaComplexType)) {
// we never make classes for simple type.
continue;
}
XmlSchemaComplexType complexType = (XmlSchemaComplexType)type;
// for named types we don't bother to generate for the
// element.
if (!JavascriptUtils.notVeryComplexType(complexType)
&& complexType.getName() == null) {
complexTypeConstructorAndAccessors(element.getQName(), complexType);
complexTypeSerializerFunction(element.getQName(), complexType);
domDeserializerFunction(element.getQName(), complexType);
}
} catch (UnsupportedConstruct usc) {