users@jaxb.java.net

Re: Resolving xjc error of repeated global elements

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 14 May 2007 17:05:04 -0700

Sounds like your A1 and A2 both include some colliding definitions.
That's really a schema problem and I don't think you can work around
that on JAXB side without fixing it in the schema.

Boyan Hristov wrote:
> Hello,
>
> I have the following jaxb use-case:
>
> There are two XML schemas, say A1.xsd and A2.xsd that:
> - Should be used as they are (they are developed by somebody else);
> - They do not depend on each other (no direct or indirect imports or
> includes);
> - Have the same targets namespace, say "ns1";
> - Both define the same global element * simple type T1;
>
> I need to create another XML schema B.xsd, that includes both A1 and A2
> and then compile it. The redundant definition casuses `xjc' to return
> the error message "a schema cannot contain two global elements with the
> same name." Using the `-nv' option changes the message to " 'T1' is
> alredy defined." Adding an external binding for the class name to the
> type definition in one of the schemas has no effect. The only way to
> make it work that I've discovered so far is to remove the repeated
> definitions from one of the supplied schemas. My xjc version is
> "hudson-jaxb-ri-2.1-322". Can anybody suggest a better methodology?
>
> Thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com