Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Different Schemas using com.sun.tools.xjc.maven2

 
Praful Thakare
Ranch Hand
Posts: 642
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have mutiple schemas and I want to genereate java classes in different package for each schema using com.sun.tools.xjc.maven2 plugin, anyone knows how to do this?

-P
 
Praful Thakare
Ranch Hand
Posts: 642
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay,resolved it with help of God (google ), used annotation in following way ..just incase some one stumbles here to find solution..



since i had 3 xsd, initially i got following error

Multiple <schemaBindings> are defined for the target namespace ""


Reason for this error is cause none of my xsd had explicit name space defined, so all of those were in default namespace..

-P
 
Rajesh Khullar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Praful,
I also have XSD with default targetNamespace and getting the same error as you.

Would you mind giving me bit more information how did you solve your issue ?

Did you put <xsd:annotation> (as you specified) in each of the schema which had default targetnamespace?

Please advise.
Thanks
Rajesh
 
g tsuji
Ranch Hand
Posts: 672
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>I also have XSD with default targetNamespace...
"defaut targetNamespace"? There is no such term as default targetNamespace. If you mean there isn't targetNamespace attribute in the schema, it means only the instance element is not namespace-qualified. The instance element may well be in null namespace, but in the realm of schema language construction, things can still be influenced by the elementFormDefault or attributeFormDefault setting...

If your schema defining the null namespace vocabulary is dispersed throughout different files, you should have xs:include element(s) in some of them. If the one having the xs:include capable of tracing out the complete schema therefrom, you can choose that as your selected (targetted) xsd, and you can put the annotation there, or preferrably make out an jxb file with jxb:bindings node attribute pointing to /xs:schema and schemaLocation attribute pointing to that particular xsd. Like this.

But definitely not in every one of your xsd files!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic