Sean F
Sean F

Reputation: 2390

jaxB conflict between namespaces

I have had some object collisions in my jaxB class generation, i know i can do things like use a custom binding file to sort out conflicts however, this conflict occurs between two elements with the same name in seperate files using different namespaces. Shouldn't the fact that they have different namespaces be enough?

parsing a schema...
compiling a schema...
[ERROR] A class/interface with the same name "code.NameType" is already in use. Use a class customization to resolve this conflict.
  line 215 of file:/C:/Workspace/schemaGen/SchemaGen/src/schemas/Core.xsd

[ERROR] (Relevant to above error) another "NameType" is generated from here.
  line 47 of file:/C:/Workspace/schemaGen/SchemaGen/src/schemas/SearchCore.xsd

Upvotes: 2

Views: 1022

Answers (1)

Sean F
Sean F

Reputation: 2390

The collision is not the problem of the namespaces but of the QName generation. that is where they clash.

There are 3 options i have found to solve this issue:

  1. Rename the class in the XSD to something else to avoid the issue.
  2. Creating a Binding File to remap the classes on generation
  3. Generate the classes from teh bottom up making episode files and specifying a new package each time so that the objects do not clash within the same package.

Upvotes: 1

Related Questions