closed as not constructive by casperOne♦ Jan 9 at 18:33
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.
5
|
I know everybody loves automatic solutions like JAXB and such, but I'd recommend hand-coding
javax.xml.bind.Marshaller and javax.xml.bind.Unmarshaller implementations to get exactly what you want without filling up your perm gen space unnecessarily. Use JDOM to parse XML and map the values into Java objects using XPath. It'll be some work to do it once, but you'll have exactly what you need and nothing more. | |||
7
|
If you have an XML schema , JAXB is nice - comes as part of the JDK. Generate java classes by running e.g.
xjc -p foo myschema.xsd
To read an XML file and get back an object (from classes generated by the xjc tool):
You can do similar things if you only want parts of an XML document converted to an object, you should e.g. be able to give JAXB part of a DOM document, instead of a whole file as done above.
| ||||
|
3
|
JAXB is the best way to convert objects to XML, and MOXy is the best JAXB implementation.
MOXy offers the following extensions:
| ||||||||
|
2
|
You can use Castor for convenient conversion of XML to Java and back.
With Castor, you can
| ||||
|