yogsma
yogsma

Reputation: 10586

XML library for Java

Does anyone know good XML library for Java which I can use to write data extracted from database into XML format?

Upvotes: 1

Views: 446

Answers (3)

BalusC
BalusC

Reputation: 1108537

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.

Upvotes: 3

Björn
Björn

Reputation: 29381

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'

Upvotes: 1

Justin
Justin

Reputation: 4116

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.

Upvotes: 2

Related Questions