Madeline
Madeline

Reputation: 1079

How to generate xml file by Java?

I have to generate huge and quite complex xml files by Java. I have to fetch the data from a Oracle database. What I really don't know is a proper and reliable way to this? I could of course create a String and concatenate all the tags, attributes and data but it doesn't feel right. I guess this is a quite common task and there are many established ways to this by Java. My question is what is the best way to this? What is your suggestion? Thank you for any clues...

Upvotes: 1

Views: 604

Answers (3)

Vikdor
Vikdor

Reputation: 24134

You could use JAXB for building XML out of structured objects that are a result of querying your data store.

If your object hierarchy is not complex, you can use Oracle's capability to generate results in XML.

Upvotes: 4

UVM
UVM

Reputation: 9914

You can use JAXP(Java API for XML parsing ) to create a XML structure.This is having all the features you wanted.

Upvotes: 2

Priyank Doshi
Priyank Doshi

Reputation: 13161

There are several options for object to xml transformation.

I would personally suggest JAXB for easy of use and saxparser for performance centric application.

Upvotes: 3

Related Questions