Hello,
I'm working on a project where we use an xml-Parser to get information abnout
specific devices. We are using the Xerces-Parser for parsing our documents. The
problem is that if we have special character like the german 'ö' or ' ° ' for
°C in our xml document the transcode-function will not transcode these strings
to a char*.
Our XML-File looks like this:
<Device Name = "test"
ID = "1">
<Devicedetails Name= "Temperatur °C"
Temp = "20"/>
</Device>
...
Parsing of the file seems to work but if i try to get the value of the
attributes the parser crashes at the attribute with the special character.
I'm parsing the file like this:
(After loading and parsing the file i'm taking the rootnode)
char* nodename = XMLString::transcode(rootnode->getNodeName);
if(strcmp(nodename,"Device")==0)
{
char* devicename;
DOMNamedNodeMap * map = rootnode->getAttributes();
XMLCh* temp1 = XMLString::transcode("Name");
DOMNode *tmp1 = map->getNamedItem(temp1);
if(tmp1 !=NULL)
{
devicename = XMLString::transcode(tmp1->getNodeValue);
}
XMLString::release(temp1);
}
XMLString::release(nodename);
...
I already tried to do several things to solve my problem. I've set the codepage
to the german one by using
setlocale(LC_CTYPE, "de_DE.UTF-8");
in my main but it didn't help.
Does anybody know a solution os has a hiont for me?
Best regards
Stefan