[xml] Workaround for bug 159547: escaping versus UTF8 in xmlNodeDump
- From: Jose Gonzalez <jgon etb bel alcatel be>
- To: xml gnome org
- Subject: [xml] Workaround for bug 159547: escaping versus UTF8 in xmlNodeDump
- Date: Mon, 18 Apr 2005 09:05:56 +0200
Hello,
I recently discovered in my application the effects of Bug 159547
(http://bugzilla.gnome.org/show_bug.cgi?id=159547), that is, UTF-8
characters get escaped.
My application performs an xmlNodeDump (from function curDumpNode, code
below) to store the results in database, I do not need to store the
escaped characters.
In the bug page it is mentioned that one can modify this default
behavior (UTF-8 getting escaped) using the API, but I have not been able
to do so.
Does someone have an example of using the API to disable the UTF-8 escaping?
Regards,
Jose
STRING PXmlDoc::curDumpNode(int dumpSelf,int isoLatin1)
{
if((docXML)&&(nodePtr))
{
xmlNodePtr curWork;
if(dumpSelf)
curWork=nodePtr;
else
curWork=nodePtr->xmlChildrenNode;
if(curWork)
{
xmlBufferPtr myBuffer=NULL;
char* daContent=NULL;
int structSize;
STRING daResult("");
myBuffer=xmlBufferCreate();
if(myBuffer)
{
xmlBufferEmpty(myBuffer);
while(curWork)
{
xmlNodeDump(myBuffer,docXML,curWork,0,0);
structSize=xmlBufferLength(myBuffer);
if(structSize>0)
{
if(daContent=(char*)calloc(structSize+1,1))
{
memcpy(daContent,xmlBufferContent(myBuffer),structSize);
daContent[structSize]='\0';
daResult+=daContent;
xmlFree(daContent);
daContent=NULL;
}
else
{
TRACE("'libpxml1_0' Error: unable to allocate a char*
variable");
}
}
xmlBufferEmpty(myBuffer);
if(dumpSelf)
break;
curWork=curWork->next;
}
xmlBufferFree(myBuffer);
myBuffer=NULL;
if((daResult.length())&&isoLatin1)
return fromUtf8ToIsolatin1((xmlChar*)(char*)(const
char*)daResult);
return daResult;
}
}
}
return STRING("");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]