Does anyone know good XML library for Java which I can use to write da开发者_如何学Cta extracted from database into XML format?
Usually, those tools are already provided by the database itself. Check the "Export" section somewhere in their documentation. A more detailed answer can't be given since the DB vendor is unmentioned.
Regardless, if you insist in using Java for this (which may however be performance/memory hogging with large data), then you may find a Javabean-to-XML serializer useful, for example JAXB, XStream or XMLBeans.
JAXB all you need to do is annotate a class and you can marshal it to XML. Works well with JPA entities / other ORMs as well.
Do you need to use a middle layer? "Most" DBMS have some XML functionality out of the box, like MySQL.
mysql -uroot --xml -e 'SELECT * FROM db.table ORDER BY field'
精彩评论