Yuanzheng Wang - 2009-07-08

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 :)