SchemaImpl schemaImpl = new SchemaImpl();
schemaImpl.setRequired(true);
schemaImpl.setElementType(WSDLConstants.QNAME_SCHEMA);
schemaImpl.setElement(schemaInfo.getElement());
for (int x = 0; x < schemaInfo.getSchema().getIncludes().getCount(); x++) {
XmlSchemaExternal ext = (XmlSchemaExternal)schemaInfo.getSchema()
.getIncludes().getItem(x);
if (ext.getSchema() == null) {
continue;
}
if (ext instanceof XmlSchemaImport) {
SchemaImport imp = schemaImpl.createImport();
imp.setNamespaceURI(((XmlSchemaImport)ext).getNamespace());
imp.setSchemaLocationURI(((XmlSchemaImport)ext).getSchemaLocation());
SchemaImpl schemaImpl2 = new SchemaImpl();
schemaImpl2.setRequired(true);
schemaImpl2.setElementType(WSDLConstants.QNAME_SCHEMA);
schemaImpl2.setDocumentBaseURI(ext.getSchema().getSourceURI());
try {
schemaImpl2.setElement(ext.getSchema().getSchemaDocument().getDocumentElement());
} catch (XmlSchemaSerializerException e) {
//ignore
}
imp.setReferencedSchema(schemaImpl2);
schemaImpl.addImport(imp);
} else if (ext instanceof XmlSchemaInclude) {
SchemaReference imp = schemaImpl.createInclude();
imp.setSchemaLocationURI(((XmlSchemaInclude)ext).getSchemaLocation());
SchemaImpl schemaImpl2 = new SchemaImpl();
schemaImpl2.setRequired(true);
schemaImpl2.setElementType(WSDLConstants.QNAME_SCHEMA);
schemaImpl2.setDocumentBaseURI(ext.getSchema().getSourceURI());
try {
schemaImpl2.setElement(ext.getSchema().getSchemaDocument().getDocumentElement());
} catch (XmlSchemaSerializerException e) {
//ignore
}
imp.setReferencedSchema(schemaImpl2);
schemaImpl.addInclude(imp);
} else if (ext instanceof XmlSchemaRedefine) {
SchemaReference imp = schemaImpl.createRedefine();
imp.setSchemaLocationURI(((XmlSchemaRedefine)ext).getSchemaLocation());
SchemaImpl schemaImpl2 = new SchemaImpl();
schemaImpl2.setRequired(true);
schemaImpl2.setElementType(WSDLConstants.QNAME_SCHEMA);
schemaImpl2.setDocumentBaseURI(ext.getSchema().getSourceURI());
try {
schemaImpl2.setElement(ext.getSchema().getSchemaDocument().getDocumentElement());
} catch (XmlSchemaSerializerException e) {
//ignore
}
imp.setReferencedSchema(schemaImpl2);