tags:

views:

84

answers:

2

Given a WSDL/XSD, what's the easiest way to produce a list of all simple & complex Types? (Java preferred.)

i.e.

<xsd:element name="ThirdPartyProductInfo" type="typens:ThirdPartyProductInfo" minOccurs="0"/>
<xsd:element name="SalesRank" type="xsd:string" minOccurs="0"/>
<xsd:element name="BrowseList" type="typens:BrowseNodeArray" minOccurs="0"/>

I'd expect the output to be:

ThirdPartyProductInfo, BrowseNodeArray, + all types referred to by the above as well.

Regexp's would probably miss a few cases, perhaps JDOM? SAX? Other?

Thanks.

A: 

XPath is a quick and easy way to grab specific elements that you are trying to get at. I have not done much webservice stuff in the past few years but I believe the Axis toolkit comes with a WSDL to Java utility? If so that would likely help you out as well.

Of course it is entirely possible that I am missing what you are trying to do.

Cheers!

another average joe
WSDL2Java is not what is desired. That will generate stubs and classes, which I have no need for. I simply just want a list of all non-builtin types. XPath seems like a viable option. I'll take a look into that. Thanks.
A: 

You can use XmlBeans to parse the XSD and inspect it. You probably still need a fair amount of code to inspect the XSD programmatically. If you don't have a fair knowledge of XSDs, the XmlBeans API might be a bit unwieldy. Javadoc is pretty good but you have to know what you are doing...

Hes Siemelink