You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Ubhay Kumar <uk...@in.firstrain.com> on 2002/06/26 18:20:29 UTC

extracting XML from DOM

Hi ...
 I needed a function which can dump the xml content of DOM_Document to 
 a file.

 I searched for such an API (which returns the content of document (xml ) as string) but i found none (Isn't this a feature required quite  normally and should be added like in microsoft's MSXML etc)....

 Also i tried to use sample file DOMPrint with some success. But i dont know how to 
 redirect the output to disk file rather then stdout. I tried using ofstream objects but following code failed to write to output file 
 

ofstream outfile("myXMLFile.xml",ios::app);
gFormatter = new XMLFormatter(gEncodingName, formatTarget,
                                        XMLFormatter::NoEscapes, gUnRepFlags); 

outfile << doc <<endl; //This doc is the DOM_Document and is correctly loaded
outfile << flush;
outfile.close();

Is this because of using ofstream object and not ostream object (like cout) ....
Is there any easier way to do this ? 

Any help would be greatly appreciated ...

Regards,
Ubhay.


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org