permaculture playing cards*
The moose likes Web Services and the fly likes JAXB : Java complilation error after XJC Compilation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "JAXB : Java complilation error after XJC Compilation" Watch "JAXB : Java complilation error after XJC Compilation" New topic
Author

JAXB : Java complilation error after XJC Compilation

Ismail Abrams
Greenhorn

Joined: Jul 26, 2012
Posts: 4
I find a problem during JAVA compiling of classes generated by XJC compiler.

This is the xsd bloc causing the problem of java compilation. there is two elements with the same name (sousAdresse) but they have a different content.



**
XJC compiler generates the class SousAdresse.java wich contain :
- protected List<Contact> contacts;
- internal class : public static class Acces, in with we find the internal class -> public static class SousAdresse
**

the solution mustn't impact the containt of the schema file.is There any configuration in the Binding file that i can do to resolve the problem ?
I need your help.
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 511
    
    3
There any configuration in the Binding file that i can do to resolve the problem ?

But what you have described seems to be a description of the default behaviour of the compiling... However, you said "problem" and "resolving". Do you mean there are compilation errors (that I tend to think it should be compiled all right), or that you mean you only do not like the structure generated and want to customize it further to your liking?
Ismail Abrams
Greenhorn

Joined: Jul 26, 2012
Posts: 4
Yes, i mean compilation errors. the generated classes must be compilated all right.is there any way to customize it ?
thanks
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 511
    
    3
If there is compilation error, what is it?

In any case, a simple question: is the definition shown xs:element name="sousAdresse" appeared in the schema as a top-level element? If not what is its parent element looks like? I would say it can't appear as a top-level element for a reason and I hope it is not.
Ismail Abrams
Greenhorn

Joined: Jul 26, 2012
Posts: 4


This is the full schema, if the schema is compiled with jaxb compiler, the generated class SousAdresse will be declared twice. That's the error.

g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 511
    
    3
That would compile just fine for jaxb ri 2.1+, if not lower as well. The issue of collision of names does not arise in this situation.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JAXB : Java complilation error after XJC Compilation