Adam Badura
Adam Badura

Reputation: 5339

gSOAP alternative in XSD genereated parser

I'm using gSOAP to generate XML parsing code from XSD Schema I prepared myself. It has nothing to do with web services. The XML data is read from a local file or in memory buffer (by providing proper istream to soap).

At first it seems simple enough. But now as I use it more and more I'm starting to see some issues.

For example names are introduced in global namespace. It is possible to enforce use of a namespace but then building becomes much more difficult (due to need of generating extra code for error handling), only one namespace can be used and due to use of macros it might cause other issues as well.

And you DO need those namespaces once you have more than one schema per binary building unit (.exe, .dll, ...)!

So I started to think about some alternative maybe. Especially that I don't need that web services staff. Only automatic code generation for parsing XML based on XSD.

Are there any such alternatives (for native C++)? What are they?

Upvotes: 1

Views: 1347

Answers (2)

Dr. Alex RE
Dr. Alex RE

Reputation: 1708

The XSD translation by gSOAP's wsdl2h does not yield C++ namespaces but rather maps XSD namespaces to a prefixed name convention (ns__name) that is pretty easy to use and that avoids name clashes in C (and C++). Any binding tool will have to enforce mapping rules of that sort. Why do you state that "And you DO need those namespaces once you have more than one schema per binary building unit"? You can simply run wsdl2h on all XSD together.

Upvotes: 0

Željko
Željko

Reputation: 81

Here is a great list of resources about XML data binding: http://www.rpbourret.com/xml/XMLDataBinding.htm

Upvotes: 1

Related Questions