[xsd-users] Resolving multiple inclusions of the same elements/attributes/types

Lyndon mail.lyndon at gmail.com
Thu Feb 9 13:00:09 EST 2012


Hi again,

I'm sure you're sick of my chameleon inclusion questions, but this time I'm
not sure if it's unique to chameleon inclusion.  I'm currently in a
situation where the xsd 3.3.0 cxx-tree generated code I'm using won't
compile because of several redefinition errors like so:

error: redefinition of `class FOOBAR::T_SomeType'
error: previous definition of `class FOOBAR::T_SomeType'

The reason for this is because of the following situation:
1) I have some schema that defines common types that will be reused.  Let's
call it C.xsd.
2) C.xsd has no namespaces defined, so any inclusions of it are chameleon
2) Another schema B.xsd includes C.xsd, but B.xsd also does not have any
namespace defined.
3) Finally, schema A.xsd, which has namespace FOOBAR, includes both B.xsd
and C.xsd

When I generate the xml binding code for A.xsd and try to compile, I get
the errors I mention earlier and it's because C.xsd got included twice both
directly by A.xsd and indirectly by B.xsd.  An easy fix for me is remove
the direct inclusion of C.xsd from A.xsd, but I wonder if there's any other
way (like command line option).  This is kind of a similar scenario to a
previous question I asked (
http://codesynthesis.com/pipermail/xsd-users/2012-February/003524.html),
but now the conflicts are within the same generated files (A.hxx and A.cxx).

Is this something that's unique to the chameleon inclusion case?  Would
cxx-tree be able to resolve the problem if namespaces were defined in B.xsd
and C.xsd or would I still suffer from the same duplicate definitions?

Many thanks in advance.


More information about the xsd-users mailing list