Included Schema not resolved in WSDL? [message #585746] |
Sun, 18 April 2004 06:46 |
Adam Ratcliffe Messages: 3 Registered: July 2009 |
Junior Member |
|
|
Hi all,
I'm wanting to use the XSD library to parse a wsdl document and gain access
to all of the defined types, both those
embedded in the wsdl document itself, and also those defined in an external
xsd document referenced by an
<include> element. When I write out the names of all of the complex type
definitions I see those defined in the main
document but not those from the external document.
I thought this could be a quirk related to parsing a wsdl document so I
rewrote my test case to use an xsd document with
an included schema and got the same result.
I've included my test case below, perhaps someone can point out where I'm
going wrong with this?
Thanks in advance,
Adam
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "wsdl",
new XSDResourceFactoryImpl());
String uri = "xml/wsdl/Party.wsdl";
ResourceSet resourceSet = new ResourceSetImpl();
XSDResourceImpl xsdSchemaResource = (XSDResourceImpl)
resourceSet.getResource(URI.createDeviceURI(uri), true);
Iterator resources = resourceSet.getResources().iterator();
while (resources.hasNext()) {
Resource res = (Resource) resources.next();
if (res instanceof XSDResourceImpl) {
XSDResourceImpl xsdResource = (XSDResourceImpl) res;
XSDSchema schema = xsdResource.getSchema();
List allTypes = schema.getTypeDefinitions();
for (Iterator iter = allTypes.iterator(); iter.hasNext();) {
XSDTypeDefinition typedef = (XSDTypeDefinition) iter.next();
if (typedef instanceof XSDComplexTypeDefinition) {
String name = typedef.getName();
System.out.println(name);
}
}
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.03196 seconds