output of this program is <test str="&#xTTT" />. It's invalid that most XMLParser would fail to parse it.
I traced the program, and I found that TiXmlBase::EncodeString causes this problem. The function will deal with hexadecimal-character-reference, and pass &#xTTT through unchanged.
So, my question is: why's that? Need to pass HCR though in TiXmlBase::EncodeString? And if I want to pack "&#xTTT" as PLAINTEXT, what should I do?
Thanks for any info on my question :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
HI,all
I've found a problem of tinyxml: when I encode string looks like hex-char-refer, for example "&#xtt", the result is wrong:
TiXmlElement *root_elem = new TiXmlElement("test");
root_elem->SetAttribute("str", "&#xTTT");
TiXmlPrinter xmlPrinter;
root_elem->Accept(&xmlPrinter);
printf("%s\n",xmlPrinter.CStr());
output of this program is <test str="&#xTTT" />. It's invalid that most XMLParser would fail to parse it.
I traced the program, and I found that TiXmlBase::EncodeString causes this problem. The function will deal with hexadecimal-character-reference, and pass &#xTTT through unchanged.
So, my question is: why's that? Need to pass HCR though in TiXmlBase::EncodeString? And if I want to pack "&#xTTT" as PLAINTEXT, what should I do?
Thanks for any info on my question :)