// at this point we can't determine the element type, so don't add anything
continue;
}
// if the schema is null generate a new one and create an import
if (schema == null) {
schema = buildNewSchema(nsKey, new NamespaceResolver(), schemaForNamespace.size(), properties);
schemaForNamespace.put(nsKey, schema);
typeAsQName = desc.getSchemaReference().getSchemaContextAsQName();
Schema schemaForUri = schemaForNamespace.get(typeAsQName.getNamespaceURI());
if (!importExists(schema, schemaForUri.getTargetNamespace())) {
Import newImport = new Import();
newImport.setNamespace(schemaForUri.getTargetNamespace());
newImport.setSchemaLocation(schemaForUri.getName());
schema.getImports().add(newImport);
}
} else {
typeAsQName = desc.getSchemaReference().getSchemaContextAsQName(schema.getNamespaceResolver());
}
}
if (schema == null) {
schema = buildNewSchema(nsKey, new NamespaceResolver(), schemaForNamespace.size(), properties);
schemaForNamespace.put(nsKey, schema);
}
Element element = new Element();
element.setName(qname.getLocalPart());
element.setType(getSchemaTypeString(typeAsQName, schema));