Hello

I have problem with writing to the file. My code looks like this:

(at this moment doc is already existing DOMDocument object with nodes and stuff)

DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(gLS);

DOMWriter *theSerializer = ((DOMImplementationLS*)impl)->createDOMWriter(); theSerializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);

theSerializer->setEncoding (XMLString::transcode("UTF-8"));


XMLFormatTarget * myFormTarget;

myFormTarget = new LocalFileFormatTarget ("users.xml");


string s = XMLString::transcode (theSerializer->writeToString(*doc));


cout << s << endl;




theSerializer->writeNode(myFormTarget, *doc);

myFormTarget->flush();

theSerializer->release();

As you can see, it is (almost) a copy paste from examples. The problem is that I see XML document printed correctly on console (cout), but file on disk (users.xml) has 0 length. ATM. I'm made a hack with fstream, but writeToString uses UTF-16, and I really need UTF-8.

--
Semper Fidelis

Adam Klobukowski
[EMAIL PROTECTED]

Reply via email to