This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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
Author

Create XML string From Arraylist in Java

ankit mahajan
Greenhorn

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: 3018
    
  35

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.


Founder of ExamLab and Systemup
See how I can help you to become an awesome programmer
William Brogden
Author and all-around good cowpoke
Rancher

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

Bill
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
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