Hi
I have a typical XML Schema (XS), where there is very deep nesting of complex types( I generated this XSD from XML instance using SPY). When I generate classes using JAXB(xjc), along with other classes, one class gets generated with n number of static inner classes in it(say
around 50). when I compile(JAVAC) this class, very long classnames
gets generated as :
Abcd$Efgh$Ijkl$Mnop$Qrst.......... and sometimes it becomes so long that MS WINDOWS( XP) does not like the file name and starts behaving abnormally with the file. I am facing this problem especially when I use something like eclipse or WSAD to compile the code. Please suggest a work around if you have come across this issue!!
As a work around, I thought of generating jaxb code from DTD, where hierarchy is not this much nested. BUT DTD is not fully supported -
what is the future of DTD support? will be removed at all? remember most of the XML docs still follow DTDs. Will the stable releases support DTD based generation?
Thanks in advance
RC
-
JAXB Practical issues. (1 messages)
- Posted by: ranji c
- Posted on: June 08 2005 09:49 EDT
Threaded Messages (1)
- Working around JAXB nesting by Matthew Gan on June 10 2005 12:29 EDT
-
Working around JAXB nesting[ Go to top ]
- Posted by: Matthew Gan
- Posted on: June 10 2005 12:29 EDT
- in response to ranji c
Hi Ranjith,
If your XSD has complex types nested in complex types, then JAXB will generate the classes in that structure using inner classes. I personally don't like the such deep nesting of inner classes, as it makes it difficult to code, document and maintain.
To workaround this problem, have your XSD define global complex types. This is so that JAXB will generate them as individual classes. I believe there's a option in SPY to generate your complex types as global types when reverse engineering your XML to XSD.
cheers
Matthew