• 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

Jdom api vs JAXB api

 
Ranch Hand
Posts: 71
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a scenario to parse an xml file and populate a bean with that data, which is the better way to do that using JDOM api or Unmarshaling ?
 
Ranch Hand
Posts: 734
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have a scenario to parse an xml file and populate a bean with that data, which is the better way to do that using JDOM api or Unmarshaling ?


The way you ask does not leave a lot to deliberate, does it? The natural choice would be jaxb, would it not? The latter is a dedicated framework to do the thing. It is like asking if it is better to use xslt to transform an xml document to another or to use a dom parser to parse the xml and then create the desired output document using that data...

But if you do not want to learn/to work with another framework like jaxb or that it is a very primitive need in populating some simple beans with data, then jdom? why not, indeed...
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If just the XML -> Java direction is of interest then you might want to consider Apache Digester. Easier to start with than JAXB, IMO.
 
The knights of nee want a shrubbery. And a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic