rocket mass heater kickstarter
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 Elasticsearch in Action this week in the Big Data 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: 3360
    
  60

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
Rancher

Joined: Mar 22, 2000
Posts: 12890
    
    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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Create XML string From Arraylist in Java