Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8634593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:45:46+00:00 2026-06-12T09:45:46+00:00

I have a set of xsd files and I need to generate java classes

  • 0

I have a set of xsd files and I need to generate java classes for these types. The problem is with multiple xsd files and multiple definitions of xml types in these files. And the multiple definitions are not all straight forward. Some over-ride the definition, some extend and some are the same with different namespaces and others are the same in all sense. There is no regular pattern(Actually these XSDs are from a different company and they need the data in xml – so they don’t care about the JAVA-XML mapping and so complaining about XSDs is not really an option :|).

I tried two different JAXB plugins(mojo and jvnet) and both of them give the same error –

com.sun.istack.SAXParseException2: Two declarations cause a collision in the ObjectFactory class.

I understand that this is bound to happen and tried a couple of things. Using mojo plugin, I tried to tell maven to compile all files seperately and put them in different packages (multiple in the plugin, each with its own and separate ), but to no avail.

And later I tried to do the same thing in another way. I used the jvnet plugin and defined the mapping of xsd and java package in the bindings.xml file as follows –

    <bindings schemaLocation="../xsd/1.0/abcd.xsd">
      <schemaBindings>
        <package name="com.xxx.services.yyy.abcd"/>
      </schemaBindings>
    </bindings>

And then I encountered this error –

com.sun.istack.SAXParseException2: Multiple <schemaBindings> are defined for the target namespace "http://www.fpml.org/FpML-5/recordkeeping"
    at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:82)
    at com.sun.tools.xjc.reader.xmlschema.ErrorReporter.error(ErrorReporter.java:79)
    at com.sun.tools.xjc.reader.xmlschema.BGMBuilder.checkMultipleSchemaBindings(BGMBuilder.java:343)
    at com.sun.tools.xjc.reader.xmlschema.BGMBuilder.buildContents(BGMBuilder.java:313)
    at com.sun.tools.xjc.reader.xmlschema.BGMBuilder._build(BGMBuilder.java:182)
    at com.sun.tools.xjc.reader.xmlschema.BGMBuilder.build(BGMBuilder.java:116)
    at com.sun.tools.xjc.ModelLoader.annotateXMLSchema(ModelLoader.java:415)
    at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:167)
    at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:113)
    at org.jvnet.jaxb2.maven2.RawXJC2Mojo.loadModel(RawXJC2Mojo.java:636)
    at org.jvnet.jaxb2.maven2.RawXJC2Mojo.doExecute(RawXJC2Mojo.java:259)
    at org.jvnet.jaxb2.maven2.RawXJC2Mojo.execute(RawXJC2Mojo.java:135)

which is the same error presented in a different way.

Now before diving into other options, I decided to find out the best strategy I should be using for this type of binding. Apparently the one I know isn’t working. Any suggestions anyone? And what can be a solution for this problem?

help much appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:45:48+00:00Added an answer on June 12, 2026 at 9:45 am

    I’ll answer my own question so that anyone searching can find it useful. The basic point to understand is that there is no way to compile all the files seperately and then group them into java packages(If there are elements that need to go to same java packages). So, the only way left is to isolate all the types that are causing the problem (as I explained, there are multiple definitions for some types) and do custom binding for them(I used external binding with a *-bindings.xml file). Be careful with enums as they were causing most of the problems(type, naming and so I had to custom map all values for each enum)

    Lesson learnt: If your XSD files are shit, you will have hard time binding them

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a set of xsd files for different data types. In the Java
When generating java beans from xsd files I would like to have the default
I have generated a set of classes based on a set of respective *.xsd
I have a XSD file, from which I want to generate C# and Java
I have set the eclipse java formatter to wrap lines that exceed 120 characters
I have set of flat files (114 files) each file is named with database
I have set onItemClicklistener on my custom list view but onItemClicklistener not working I
I am using SSIS in Visual Studio 2008. I have many XML files that
Suppose we have some .xml files containing, amongst other things, MIDI note data. Since
I have a set of classes which hold only data (no operations have been

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.