I have a object of org.eclipse.xsd.impl.XSDSchemaImpl class of a xsd schema [say A.xsd]. This schema has some <xs:include> tags for including other supporting schemas [say B.xsd and C.xsd]. Now I want to convert this XSDSchemaImpl object into a String such that it include all the element definitions which are defined in the supporting included schema [i.e in B.xsd and C.xsd] will be part of this string. I tried it this way but it gives me only A.xsd in the String.
public Writer writeSchema(XSDSchema schema) throws IOException {
if (schema == null){
return;
}
URI schemaUri = URI.createFileURI("");
Resource resource = new XSDResourceFactoryImpl().createResource(schemaUri);
resource.getContents().add(schema);
XSDResourceImpl xsdResource = (XSDResourceImpl) resource;
Writer strWriter = new StringWriter();
try {
xsdResource.save(writer, null);
} finally {
xsdResource.unload();
}
return strWriter ;
}
.
I posted the same message here too. As I am not sure which is the correct forum for this. http: //www.eclipse.org/forums/index.php /m/764951/#msg_764951