tags:

views:

26

answers:

1

Hi there, this is my first question, so please be gentle ;)

I'm stuck with a weird problem. Essentially i get three XSD definitions like the following:

PartA.xsd
targetNameSpace="PartA"
include="PartB.xsd"

PartB.xsd
<!-- no namespace definition!!! -->

PartC.xsd
targetNameSpace="PartC"
inlude="PartB.xsd"
import="PartA.xsd"

The error pops up, when binding PartC via JAXB to Java classes:

  • A class/interface with the same name "b.exampleType" is already in use. Use a class customization to resolve this conflict.
  • This confusing error happened most likely because the schema uses a technique called "chameleon schema", which causes a single definition to be loaded multiple times into different namespaces. See http://forums.java.net/jive/thread.jspa?threadID=18631 for more about this.

Following the link, i found out, the actual error lies in PartB, which has no namespace declaration! This method is called Chameleon Schema. The defined types in PartB will adopt the namesspace of the importing XSD.

So in my case, there are two namespaces for the same type:

  1. "PartA"
  2. "PartC"

And this is, where JAXB breaks down. I haven't found a way to bind PartC properly. And (to make things tricky) i have chance to change the original XSD definitions!

Has anyone come across this phenomena or something like that before and has a valid workaround for it?

A: 

The following is available, although it does not provide a lot of detail:

Blaise Doughan
Thanks for the link, but you are right, it's not really detailed. And since i don't have write-access on the schema, i'm stuck. ... Although, maybe i can argue with the schema author on the "In some other cases, the chameleon schema can be argued as a bad schema design, as it duplicates definitions in many places." point.
Florian Becke