[xsd-users] --namespace-map and xs:include

Chris Delnooz Chris.Delnooz at hydrix.com
Thu Dec 12 00:29:08 EST 2013


I have two schema's, say A.xsd and B.xsd neither of which specifies a target namespace. I've generated code for A.xsd with --namespace-map =A because I do want a namespace in code and B is generated with a similar directive --namespace-map =B. So far no problems, it works fine.

The problem arises when we wanted to use a class from A.xsd in B.xsd. Let's say class X is defined in A.xsd, so a C++ class A::X is generated, which is exactly what I wanted. B.xsd now xs:includes A.xsd and the generated code contains the correct #include A.hpp. Now in B.xsd there is a class Y that has an element of type X. The generator generates a typedef like "typedef B::X XType" which won't compile because in the C++ world it should have been "typedef A::X XType"

Is there any way to tell the generator to prefix the stuff it got via the xs:include with A and the rest with B?

Cheers!

Chris Delnooz | Software Architect
chris.delnooz at hydrix.com<mailto:chris.delnooz at hydrix.com>
Hydrix: Our Expertise - Your Competitive Advantage
www.hydrix.com<http://www.hydrix.com/> | fax +61 3 8573 5289 | direct +61 3 8573 5248



More information about the xsd-users mailing list