permaculture playing cards
The moose likes XML and Related Technologies and the fly likes How to do XML databinding? 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 "How to do XML databinding?" Watch "How to do XML databinding?" New topic

How to do XML databinding?

Siegfried Heintze
Ranch Hand

Joined: Aug 11, 2000
Posts: 397
I need to read in a short XML file to populate the drop downs in a dialog box. After the user has made his selections, I need to alter the contents of a second larger (200 lines) xml file.

How would you do this? I was thinking I would use databinding. What is fashionable these days? I have Brett's book "Java, XML & Databinding" and it discusses Zues and mentions JAXB but the book is kinda old (may 2002). Are there more fashionable ways to load an XML file into a plain old java object?

How would you do it? Would you bother with databinding? I could just use xerces, I suppose. Ugggh...
Craig Caulfield

Joined: Dec 12, 2005
Posts: 3
Data binding is a good option if you don't want to get down to the nitty gritty of DOM and SAX programming.

Brett McLaughlin's book was one of the first to discuss data binding and suffers because it came out when the technology was still evolving. Check out IBM developerWorks ( for a good range of up-to-date articles and tutorials on data binding.

My personal favourite is JAXB: it's simple and powerful and if you're working with web services you'll probably come across it anyway. Currently JAXB it is part of Sun Web Services Developer Kit, but it will soon become part of the standard JDK.

An alternative worth trying if you're looking for a lightweight solution for reading, say, configuration files, is the Apache Jakarta Commons Digester (
I agree. Here's the link:
subject: How to do XML databinding?
It's not a secret anymore!