• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jdom api vs JAXB api

 
Sudhakar Sharma
Ranch Hand
Posts: 71
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • 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 ?
 
g tsuji
Ranch Hand
Posts: 656
3
  • Mark post as helpful
  • send pies
  • 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...
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic