users@jaxb.java.net

Resolving xjc error of repeated global elements

From: Boyan Hristov <HristovB_at_dor.state.fl.us>
Date: Mon, 23 Apr 2007 10:09:45 -0400

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