File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Create XML string From Arraylist in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Create XML string From Arraylist in Java" Watch "Create XML string From Arraylist in Java" New topic

Create XML string From Arraylist in Java

ankit mahajan

Joined: Jul 30, 2013
Posts: 7

I want to create an XML string from data retrieved from the database in a ResultSet in java.
Can I do so by using Collection ArrayList.
If yes then how?
Devaka Cooray
ExamLab Creator

Joined: Jul 29, 2008
Posts: 3921

Yes, and it doesn't matter if it is an ArrayList or any other data structure populated with the contents you want to write to XML. Read XML FAQ for a list of APIs you can use to read/write XML contents.

Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
Recall that XML is just text with a strict format requirement so you can create an XML document with simple println() statements if you want to.

I agree. Here's the link:
subject: Create XML string From Arraylist in Java
It's not a secret anymore!