I agree with the first respondent that you can get a very nice human-readable XML representation, just write a little code.
I took the same approach back in 2002 to create an intermediate level business object for the XML / PDF / HTML / XHTML / XLS reporting tool. It took only a few hours to program a business object into an XML converter. I took advantage of the fact that objects were not self-referential. Otherwiise, I would have to add link elements, and not just align the values.
There is also a WebRowSet method if you are using Java 5 or later. I canโt say that its output looks super attractive to use directly with XSLT, but it can still be used. More enjoyable than a typical JAXB output.
However, there is now a cooler approach if you are using Java 6 or later.
If you use JDBC 4, you can specify a dataset with a generic parameter that identifies the class, and JDBC will populate the fields of that class with data. This is the first half of the trick. See JDBC Annotations for more information.
The second half of the trick is to use XStream to convert a collection of them into XML. XStream usually gives a good result for the first time.
You can make the XML generated really clean, understandable, compressed (ie, "dense") using the supplied XStream with some aliases to use. And if that doesn't work, there are many other ways to fine-tune output .
source share