aspose file tools*
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
Saloon Keeper

Joined: Jul 29, 2008
Posts: 2885

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
My Home Page -- Twitter Profile -- JavaRanch FAQ -- How to Ask a Question
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12682
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.


Java Resources at
I agree. Here's the link:
subject: Create XML string From Arraylist in Java
Similar Threads
Java and XSLT
Doubts regarding ArrayLists
JDOM - need help ... simple problem driving me insane
ArrayList of ArrayList<String>
How do you create an array of typesafe-collections?