private void generateGlobalElementDictionary() {
// to handle 'any', we need a dictionary of all the global elements of all the schemas.
utils.appendLine("this.globalElementSerializers = [];");
utils.appendLine("this.globalElementDeserializers = [];");
for (XmlSchema schemaInfo : xmlSchemaCollection.getXmlSchemas()) {
XmlSchemaObjectTable globalElements = schemaInfo.getElements();
Iterator namesIterator = globalElements.getNames();
while (namesIterator.hasNext()) {
QName name = (QName)namesIterator.next();
XmlSchemaElement element = (XmlSchemaElement) globalElements.getItem(name);
// For now, at least, don't handle elements with simple types.
// That comes later to improve deserialization.
if (JavascriptUtils.notVeryComplexType(element.getSchemaType())) {
continue;
}
// If the element uses a named type, we use the functions for the type.
XmlSchemaComplexType elementType = (XmlSchemaComplexType)element.getSchemaType();
if (elementType != null && elementType.getQName() != null) {
name = elementType.getQName();
}
utils.appendLine("this.globalElementSerializers['" + name.toString() + "'] = "
+ nameManager.getJavascriptName(name)
+ "_serialize;");
utils.appendLine("this.globalElementDeserializers['" + name.toString() + "'] = "
+ nameManager.getJavascriptName(name)
+ "_deserialize;");
}
globalElements = schemaInfo.getSchemaTypes();
namesIterator = globalElements.getNames();
while (namesIterator.hasNext()) {
QName name = (QName)namesIterator.next();
XmlSchemaType type = (XmlSchemaType) globalElements.getItem(name);
// For now, at least, don't handle simple types.
if (JavascriptUtils.notVeryComplexType(type)) {
continue;
}
// the names are misleading, but that's OK.