• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XML to JAVA binding with CASTOR or JAXB

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody,

I've XML file which is very Hierarchical in structure and I was wondering can I use castor or jaxb for generating java classes. I tried to use Castor sourcegenerator but it created too many java files for XML file. I guess it created java file for all elements and attributes. My XML file looks like this:


and much more embeded structure. I guess I can not use the form of <ad value=" "/> for castor?

Please suggest me the simplest way of mapping XML to JAVA classes.

Thanks,
nanu
[ February 11, 2005: Message edited by: Kedlu Nanu ]
 
Kedlu Nanu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For any element if CASTOR/JAXB are creating classes then I can't afford that or am I doing something wrong?

Please comment
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But what do you want actually?
Castor or any other JAXB Implementator SHOULD create those helper classes. otherwise how will you fill in the data in the actual Java Objects?

What I could recommend to you is actually that You should investigate the requirements of the functionality and go on later even without JAXB.
-If the data structure is too complicated in the XSD, I find that Castor's Mappings are not 100% correct.
-Do you have to process each element you receive as XML, or just some few of them, in this case I advice you to use the simplest API ever created for XML Processing: the SAX.

REGARDS AND GOOD LUCK
R�SDEM E ZAL�
 
WARNING! Do not activate jet boots indoors or you will see a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic