jQuery in Action, 2nd edition*
The moose likes XML and Related Technologies and the fly likes Jdom api vs JAXB api Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Jdom api vs JAXB api" Watch "Jdom api vs JAXB api" New topic
Author

Jdom api vs JAXB api

Sudhakar Sharma
Ranch Hand

Joined: Apr 04, 2009
Posts: 71

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

Joined: Jan 18, 2011
Posts: 499
    
    3
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
Marshal

Joined: Mar 22, 2005
Posts: 41114
    
  45
If just the XML -> Java direction is of interest then you might want to consider Apache Digester. Easier to start with than JAXB, IMO.


Ping & DNS - my free Android networking tools app
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Jdom api vs JAXB api
 
Similar Threads
reading xml file dynamically
find org.jdom.Element in JTree
Sample DOM/SAX Question #4
Which one to use?
DOM or SAX