On Mon, Sep 15, 2008 at 2:30 AM, Daniel Burrell
<[EMAIL PROTECTED]> wrote:
> Hey I have a DOMDocument,
> What's the best way to get it's xml (human readable) data into an iostream
> object, ready for whatever I want to do with it?

Something along these lines (from memory, early morning, might be some errors)

DOMDocument * doc = NULL;

//snip, say you create your document, bla bla

DOMImplementation * impl =
DOMImplementationRegistry::getDOMImplementation (X ("Core"));
DOMWriter * theSerializer = impl->createDOMWriter ();
XMLFormatTarget * formTarget = new MemBufFormatTarget;

theSerializer->writeNode(formTarget, *doc);
std::string xmlString = (char *) ((MemBufFormatTarget *)
formTarget)->getRawBuffer ();

>From the char*, it's easy to put it into an iostream. Now this of
course is for a one time.

HTH

-- 
question = ( to ) ? be : ! be;
      -- Wm. Shakespeare

Reply via email to