[xsd-users] Re: Trying to generate a WSDL parser using xsd
boris at codesynthesis.com
Mon Mar 12 07:16:10 EDT 2012
Stefan Pantos <d922qg at me.com> writes:
> Firstly, in this version I forgot to make line 4 'definitions =
> wsdl::definitions(inputfile, ::xml_schema::flags::keep_dom);'
You also need to remember to initialize Xerces-C++ yourself since you
are using both keep_dom and --generate-wildcard. See documentation for
these features for details.
> I still don't understand all the validation errors, if anyone is able
> to enlighten me
Yes, see Q 2.1 in the C++/Tree Mapping FAQ:
> and I'm still wondering what the best way is to go about parsing XSD
> files for my own use.
Yes, that would be the next big question. Using data binding to parse
WSDL files is definitely an interesting idea. However, as far as I
remember, WSDL files can contain embedded XML Schema fragments (that
describe messages). Unfortunately, XML Schema doesn't have a usable
specification of itself (there is XMLSchema.xsd, but, funnily enough,
it is not valid; good example of the "do as I say, not as I do"
principle). Maybe it is possible to "fix it up" so that it is at least
usable for data binding, if not validation.
Other than that, your other options are:
1. Handle it as raw XML (e.g., using DOM).
2. Use Xerces-C++ schema representation. Not very easy to use though.
However, you get error checking of the schema.
3. Use libxsd-frontend. This is an XML Schema compiler frontend that
is used by both XSD and XSD/e. It provides a semantic graph of the
schema model plus visitor-like traversal of this graph. Built on
top of Xerces-C++.
More information about the xsd-users