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

Lyndon mail.lyndon at gmail.com
Thu Feb 9 13:12:42 EST 2012


Sorry I also have a related question:

Consider the chameleon inclusion case:
1) B.xsd, C.xsd D.xsd has no namespace defined.
2) B.xsd includes D.xsd
3) C.xsd includes D.xsd
4) A.xsd, which has namespace FOOBAR, includes B.xsd and C.xsd

My compiler will give me the same "redefinition" errors for A.hxx because
D.xsd is indirectly included twice into A.xsd.  In this case, I don't have
an easy out like in the previous scenario.  Any suggestions or workarounds?


On Thu, Feb 9, 2012 at 10:00 AM, Lyndon <mail.lyndon at gmail.com> wrote:

> 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