Generating Java classes from XML file

2020-06-21 10:53发布

问题:

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.

回答1:

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



回答2:

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



回答3:

Altova is also the best to generate java Classes from XML/XSD



标签: java xml class