You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Krishna Vemuri <kr...@electroneconomy.com> on 2000/09/12 00:35:29 UTC

DOM toString()

I am novice in, trying to understand, the big picture of the xml & java
technology, my question is, does the w3c spec provide support for converting
a DOM to a String?? if not, what is the best possible way of converting a
DOM to String??

thanks,
Krishna



Re: DOM toString()

Posted by Hans Gill <ha...@rhinosystemsinc.com>.
Hi Krishna,
   Here is some code that will help. Its actually quiet easy. Good luck

void domToString(Document Dom)
    {
        try {
        OutputFormat format = new OutputFormat(Dom);
        StringWriter stWriter = new StringWriter();
        XMLSerializer xSer = new XMLSerializer(stWriter, format);
        xSer.asDOMSerializer();
        xSer.serialize( Dom.getDocumentElement() );
        }
        catch (IOException i){}
    }


Krishna Vemuri wrote:

>
>
> I am novice in, trying to understand, the big picture of the xml &
> java technology, my question is, does the w3c spec provide support for
> converting a DOM to a String?? if not, what is the best possible way
> of converting a DOM to String??
>
> thanks,
> Krishna
>

--
--------------------------------------
Hans Gill
Software Engineer
Java and Web development
(530) 888-6248 ext 207
RHINO Systems Inc.
www.rhinosystemsinc.com
--------------------------------------
******Free reminder service at *******
******  www.thoughtshot.com    *******
--------------------------------------