At 03.48 29/12/2006 -0800, Alexis Blaze wrote:

like the subject said... i have some problem in converting DOMDocument into
XMLCh string..

The quickest way is to use:

XMLCh tempStr[100];
XMLString::transcode("LS", tempStr, 99);
DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
DOMWriter *theSerializer = ((DOMImplementationLS*)impl)->createDOMWriter();
XMLCh* str=theSerializer->writeToString(*doc);

i'm trying to used MemBufFormatTarget to do a writeChar, but
the resulting XMLCh string is still empty.. i have test the DOMDocument by
writing it to the console using StdOutFormatTarget and it's not empty...
how can we convert a DOMDocument into XMLCh string or even better char *...

If you need to write into a char* (I guess using UTF-8), you should do:

MemBufFormatTarget target;
XMLString::transcode("utf-8", tempStr, 99);
theSerializer->setEncoding(tempStr);
theSerializer->writeNode(&target, *doc);
const XMLByte* utf8str=target.getRawBuffer();

Alberto


Thank for your help..
--
View this message in context: http://www.nabble.com/problem-at-converting-DOMDocument-into-XMLCh-string-tf2894305.html#a8086423
Sent from the Xerces - C - Users mailing list archive at Nabble.com.

Reply via email to