Hi All,
We are trying convert the DOM into string. But it is converting
few characters into question mark. Characters are within the ISO 8859-1 code
page.
Below is sample code for converting the DOM to string
DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(0);
DOMLSSerializer* serializer =
((DOMImplementationLS*)impl)->createLSSerializer();
DOMLSOutput* out = ((DOMImplementationLS*)impl)->createLSOutput();
XMLFormatTarget *target = new MemBufFormatTarget();
out->setByteStream(target);
out->setEncoding( STRINGTOXMLCHAR("ISO-8859-1"));
serializer->write(node, out);
char* theXMLString_Encoded = (char*)
((MemBufFormatTarget*)target)->getRawBuffer();
*buffer = (char *) MEM_alloc(strlen(theXMLString_Encoded) + 1);
tc_strcpy(*buffer, theXMLString_Encoded);
serializer->release();
out->release();
delete target;
Thanks,
Vinayak.