-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Description
I'm working with a project need to parse unicode-characters, I got a xml-file almost like this:
<map>
<unicode v="λ"/>
<unicode v="a"/>
</map>
The value of attribute "v" in node "unicode" is an unicode character, (λ and a actually in above), the question is there's no function to access it (even if with ASCII-encoding, like 'a'), I try to code like:
const XMLElement* root = _doc.RootElement();
const XMLElement* e = root->FirstChildElement("unicode");
int v = 0; // or wchar_t
// add a function like QueryCharAttribute that can read unicode character ?
int err = e->QueryIntAttribute("v", &v); // I got a error 'XML_WRONG_ATTRIBUTE'
and I tried this:
const char* s = e->Attribute("v");
wchar_t c = (wchar_t)s[0]; // I got a wrong value for 'λ'
I know there's a stupid way to solve this problem, just replace the unicode-character with it's code point, the xml would be like:
<map>
<unicode v="955"/>
<unicode v="96"/>
</map>
but is there any more efficient way to achieve my goal?
Thanks!
Metadata
Metadata
Assignees
Labels
No labels