Meaningless Drivel is fun!*
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 3029

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: 12761
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.

wood burning stoves
subject: Create XML string From Arraylist in Java
Similar Threads
ArrayList of ArrayList<String>
How do you create an array of typesafe-collections?
JDOM - need help ... simple problem driving me insane
Java and XSLT
Doubts regarding ArrayLists