File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Java -> XML Binding Tool 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 "Java -> XML Binding Tool" Watch "Java -> XML Binding Tool" New topic

Java -> XML Binding Tool

Richard Butterwood
Ranch Hand

Joined: Nov 07, 2005
Posts: 45
Can anyone recommend a tool to convert XML into POJO'S? I am currently researching Any other suggestions?

Thank you.
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
Apache's XMLBeans creates POJOs (beans) that are actually facade objects, backed by the
XML DOM tree. This means that bean.setName("Jeff") updates the backing DOM.
I don't know if this is what you are looking for, but I've been using XMLBeans
extensively on one of my current projects and it was just what I was looking for.
[ November 10, 2005: Message edited by: Jeff Albrechtsen ]

There is no emoticon for what I am feeling!
Richard Butterwood
Ranch Hand

Joined: Nov 07, 2005
Posts: 45
Jeff, thanks for your reply.

All I need to do convert the XML files into POJO's. These POJO will be serialized and transmitted to another application. Is XML Beans too heavy to do something as lightweight as this?
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Most of the products I've seen for Java-XML mapping require you to produce a schema for the XML you plan to make into Java objects, or something equivalent. So if you didn't have arbitrary XML documents in mind, maybe one of those products would work for you.

I was going to suggest that the standard Java object which you can convert XML into is an org.w3c.dom.Document object, but that doesn't have to be Serializable so it might not work. But if you're going to send it to another application, why not just send the XML document itself and let the other application parse it?
Tony OHagan

Joined: Nov 28, 2005
Posts: 1
I think this is what you're after:

david lightman
Ranch Hand

Joined: Nov 03, 2004
Posts: 82
will this xmlbeans also be good to transform a DTO or pojo, into XML?
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Another option might Jakarta Commons Digester.
I agree. Here's the link:
subject: Java -> XML Binding Tool
jQuery in Action, 3rd edition