File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes XML to Object(s) 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 "XML to Object(s)" Watch "XML to Object(s)" New topic
Author

XML to Object(s)

ben oliver
Ranch Hand

Joined: Mar 28, 2006
Posts: 374
given an XML file, its schema, how can I obtain an Java Object(s) representation mapping to the XML ?

1. I googled and found "Castor" is one. Any other tool can be used to convert XML file with schema into Java Objects ?

2. What do I need to 'prepare' if I use Castor to generate the Java Object(s) for me ? I assume that besides the XML file, I need the java class format, and some kind of mapping file showing the relation between class instance variables and XML elements/attributes, is that right ? anything else ?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
You should take a look at Sun's updated JAXB toolkit.
Bill
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
The Using JAXB: Basic Examples of the The Java Web Services Tutorial should answer all of your questions.
ben oliver
Ranch Hand

Joined: Mar 28, 2006
Posts: 374
So can I assume that, concerning what I want to do, JAXB is a better choice than Castor ?
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Castor is in independent project that predates JAXB. I haven't used it, so I can't say how good it is. By all accounts it looks like JAXB will be becoming part of Java or Java Enterprise Edition.
Mike Moreira
Greenhorn

Joined: Apr 11, 2003
Posts: 4
You can use XMLBeans, is very nice to use, but I�m having problems with multiple version of the XSD/XML.

[]�s
Mike Moreira
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: XML to Object(s)
 
Similar Threads
Facade design pattern in web services
XML to Java object using JAXB
Specify namespaces in mapping file
which pattern to use??
XML and Object already defined. JAXB type questions