Hi Reshma.
do u mean to say, converting Document to string, which is in XML format
then here is the answer, using Xercers1.4 API from apache
public static String getDocumentAsString(Document doc) throws Exception
{
OutputFormat format = new OutputFormat("XML","UTF-8",true);
ByteArrayOutputStream str = new ByteArrayOutputStream();
XMLSerializer serializer = new XMLSerializer(str, format);
serializer.serialize(doc.getDocumentElement());
return str.toString();
}
i hope this will help u
Vijay Kumar
-----Original Message-----
From: Gude Reshma [mailto:[EMAIL PROTECTED]
Sent: Friday, March 15, 2002 5:40 PM
To: [EMAIL PROTECTED]
Subject: Converting DOM to XML
hi,
after parsing a document i get the document object. I do some
modifications to it. Now i want to convert the document back to XML. How
can i do this?
the com.ibm.xml.parsers.TxDocument provides a print method that converts
a document object to String . However i wasnt able to get the package.
Is it deprecated?
thanx.
_____
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]