I can't seem to get entities handled properly. The documentation (http://www.grinninglizard.com/tinyxmldocs/index.html) says:
TinyXML recognizes the pre-defined "character entities". These are recognized when the XML document is read, and translated to there UTF-8 equivalents. For instance, text with the XML of "Far & Away" will have the Value() of "Far & Away" when queried from the TiXmlText object.
Here's my test case:
File test.xml:
<?xml version="1.0" encoding="utf-8" ?>
<unicode_test>Here's an ampersand: & and here's another one: &</unicode_test>
My code:
TiXmlDocument Doc("test.xml");
bool loadOkay = Doc.LoadFile();
if (loadOkay)
{
TiXmlHandle DocH(&Doc);
const char* TextValue = DocH.FirstChild("unicode_test").FirstChild().ToText()->Value();
}
When I watch the value of TextValue I get "Here's an ampersand: & and here's another one: &" instead of the expected UTF-8 equivalent string.
What am I doing wrong? How can I get TinyXML to handle character entities as UTF-8?
Thanks,
~/jc
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I can't seem to get entities handled properly. The documentation (http://www.grinninglizard.com/tinyxmldocs/index.html) says:
TinyXML recognizes the pre-defined "character entities". These are recognized when the XML document is read, and translated to there UTF-8 equivalents. For instance, text with the XML of "Far & Away" will have the Value() of "Far & Away" when queried from the TiXmlText object.
Here's my test case:
File test.xml:
<?xml version="1.0" encoding="utf-8" ?>
<unicode_test>Here's an ampersand: & and here's another one: &</unicode_test>
My code:
TiXmlDocument Doc("test.xml");
bool loadOkay = Doc.LoadFile();
if (loadOkay)
{
TiXmlHandle DocH(&Doc);
const char* TextValue = DocH.FirstChild("unicode_test").FirstChild().ToText()->Value();
}
When I watch the value of TextValue I get "Here's an ampersand: & and here's another one: &" instead of the expected UTF-8 equivalent string.
What am I doing wrong? How can I get TinyXML to handle character entities as UTF-8?
Thanks,
~/jc
Can somebody point me in the right direction please?
Thanks,
/~jc
Can somebody please help?
Thanks,
/~jc