Originally posted by Silvio Esser:
If I need to create a XML document, I can use JAXP(DOM) or JAXB. But which way is the best?
That depends entirely on where the data for the XML document comes from, and what you plan to do with the XML document.
If you have a
Java object and you want to convert it into XML, and subsequently convert back into the same object, then use JAXB. If you have data in a database (for example) and you want to make it into XML, then use one of the JAXP technologies. As usual in the computing business there is no such thing as "best". Spend some time learning about the various XML technologies and you will not find it necessary to ask questions like this one. Specific questions are much easier to answer.