Skip to main content

2 xsd files with duplicate complexType, how to convert to java?

1 reply [Last post]
Joined: 2007-07-18
Points: 0

Hi, I'm new to Jaxb and tried to search in the mailinglist and the forum, but I cannot seem to find an answer to my problem.

I have 2 public xsd files which you can find here:

I would like to use these schema's for xml marshalling in java. I can run xjc to convert one of the schema's into Java objects. This works perfectly. But when I want to convert the 2 xsd files at the same time I run into error:

[xjc] [ERROR] A class/interface with the same name "pacs.CreditorReferenceInformation1" is already in use. Use a class customization to resolve this conflict.

I understand the problem, both xsd files contain the same (duplicate) complexType "CreditorReferenceInformation1". (For me this object is really the same object).

What I cannot figure out is how to solve this problem? Should I use XJC Customizations? (The error suggests a class customization). Where can I find an appropriate example?

I have two goals:
1) I do not prefer to mannually change the xsd files.
2) I do not want to have duplicate java code

Hints and tips are much appreciated!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2007-02-07
Points: 0

You could compile them separately and use an external binding file with one of the compilations to rename the class for the duplicate type to something else. I don't recall the exact syntax required, but it's something like this:

Of course then you would simply not use the DuplicateCreditorReferenceInformation1 class.