What is the best way to create XML files in Java?

David Thielen picture David Thielen · Feb 25, 2014 · Viewed 10.3k times · Source

We are presently using dom4j to create XML files. However, I'm guessing there's something better now. If we are Java 1.6 or later, what is the best (fastest when running, simple to use) class(es) to use when writing out an XML file.

I do not need to build a DOM and then write the entire DOM. I just need something that will write out the elements/attributes as I pass them to the class.

thanks - dave

Answer

Chan picture Chan · Feb 25, 2014

My 2 cents goes to java-xmlbuilder. Only for building though. It's hell a lot less complicated than JAXP.