Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to return entire xml as string

843834Apr 21 2008 — edited May 10 2008
hi
i have created a xml using DOM
DocumentBuilderFactory fctry=DocumentBuilderFactory.newInstance();
DocumentBuilder bldr=fctry.newDocumentBuilder();
Document doc = bldr.newDocument();
doc.setXmlVersion("1.0");
//XmlDeclaration xd = doc.CreateXmlDeclaration("1.0", "utf-8", null);
//doc.a AppendChild(xd);
Element el = doc.createElement("Messages");
Node root = doc.appendChild(el);

for (String msg :messages)
{
Node node = doc.createElement("msg");
node.setTextContent(msg);
root.appendChild(node);
}
now i want to return entire xml as a string , with all the tag name
so how can i return?

Regards
praveen
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 7 2008
Added on Apr 21 2008
4 comments
127 views