views:

75

answers:

2

Hello,

How can I get java classes from an xml file?

In this situation, I don't have an XML schema and this way I can't use JAXB, Castor or other xml binding API as far as I know.

+4  A: 

You can generate schema from XML file using certain tools. Then, use Apache XMLBEANS to create your classes.

Pablo Santa Cruz
Thanks @Pablo. I could use a program from the "certain tools" list to get the schema from the xml file. Now is easy to convert it to java classes using JAXB.
marionmaiden
A: 

XStream is great for XML -> objects and vice versa. Fast, lightweight, and works well without any schema.

Brian