Hello Mandeep,

I use the code delow and it works just fine.
Check this out.
If it still doesn;t work then check from the file properties, when was the last
modification, in case you wrote a wrong path.


------------------------------------------------------------------------------------------------------------------------------------
DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(0);
DOMWriter* writer = ((DOMImplementationLS*)impl)->createDOMWriter();
LocalFileFormatTarget myFormTarget(your_file_name);

try
{
             writer->writeNode(&myFormTarget , *root);
}
catch(...) { cout << "Unexpected error.\n"; }
writer->release();
------------------------------------------------------------------------------------------------------------------------------------


Friendly,
gkasap



//////////////////////////////////////////////////////////////////////////////////////////////////





-----Original Message-----
From: Mandeep Singh Bhatia [mailto:[EMAIL PROTECTED]
Sent: Δευτέρα, 21 Ιουλίου 2003 5:32 μμ
To: [EMAIL PROTECTED]
Subject: writing a DOM tree directly to a file


Hi,
  I am writing a DOM tree to a file. Have a look at this code snippet:

        SomeFn () {
        ...     // SOme code
        // writing to test1.xml, the tree represented by root.
        myFormTarget = new
LocalFileFormatTarget("C:\\Mandeep\\Xerces\\samples\\DOMPrint\\test1.xml");
        xercesWriter->writeNode(myFormTarget,*root);
        delete myFormTarget;
        ...     // Some code
        }

I am writing to a file thru writeNode using LocalFileFormatTarget. But only
thing getting printed in xml file is this:              <

Please note that when I write out the same root node to a string using
writeToNode, then the string contains the whole xml represented by root.
Also note that I have tested this thing in sample code (the DOMPrint sample)
and there it is successful. The xml file is written properly.

Any clues of what might have gone wrong??

regards,
Mandeep.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to