[xsd-users] Including external schemas to reduce code duplication?
Lyndon
mail.lyndon at gmail.com
Thu Feb 2 01:43:59 EST 2012
Current software versions:
xsd 3.3.0
xerces 2.7.0
gcc 4.1.2
My compiler is complaining about the duplicated code in the following
situation:
Say I have three schema definitions: A.xsd, B.xsd, C.xsd.
A.xsd has some common element and type but no target namespace defined.
B.xsd has a target namespace called "Foobar" and includes A.xsd via
<xs:include> (chameleon inclusion).
C.xsd also has a target namespace called "Foobar" and also includes A.xsd
via <xs:include> (chameleon inclusion)
.
When I generate code using xsd cxx-tree, it looks like the included
elements and types from A.xsd are being generated and duplicated within my
B.cxx and C.cxx. In a previous version of xsd (2.3.1), the default
behavior was to produce #include "A.hxx" in both B.hxx and C.xx, but it
doesn't seem like this is the case anymore.
As a workaround, I used the --namespace-map option to map "Foobar" to two
different C++ namespaces for B.hxx and C.xx respectively, but I was
wondering if there was a way to reproduce the behavior from the previous
version. Please let me know. Thanks!
More information about the xsd-users
mailing list