Mr. Gaitonde,
You could try using the org.apache.xml.serializer classes.

Something like this may do what you want:

import org.apache.xml.serialize.*;
import java.io.*;


. . OutputFormat format = new OutputFormat( doc ); StringWriter stringOut = new StringWriter(); XMLSerializer serial = new XMLSerializer( stringOut, format ); serial.serialize( doc.getDocumentElement() );


Then you can access the string:

  System.out.println( "STRXML = " + stringOut.toString() );




Thanks, Jeffrey Rodriguez XML Development IBM Cupertino





From: Salil Gaitonde <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Document toString()?
Date: Fri, 24 Mar 2000 08:53:42 -0800 (PST)

Hi,

I am new to the Xerces-J parser... I'd previously
been using Sun's parser.

I am trying to get a Document "toStringed" so that
I can send it to a back-end legacy app which currently
doesn't understand DOM.

Sun's parser handled this easily because I could just do
a Document.toString() and the entire tree would flatten
into a string...  "<hello>there</hello>"

Is there an easy way to do this sort of thing with Xerces?
Thanks,
Salil

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com



Reply via email to