Hi
(Some insight in xerces might be needed to be able to help me)
I use xerces to parse a config file to extract strings so that I can support
different languages.
It basicly looks like this:
As u can see I use UTF-8 encoding beacuse I want to be able to support all
kinds of goofy charaters. Now, since I haven’t been working with unicode
before I’m really confused and it only get’s worse. Here’s a bit of the code
I use to read the strings from the file…
The argument pNodes is a DOMNodeList with all the Phrase tags
void Unicode::ReadStrings(DOMNodeList* pNodes)
{
bool found_language = false;
DOMCharacterData* child;
DOMElement* attribute;
int node_list_length = pNodes->getLength();
for (int i = 0; i < node_list_length; ++i)
{
// This is used to get the key value
attribute = dynamic_cast<DOMElement*>(pNodes->item(i));
// This is used to get the string that corresponds to the key
child =
dynamic_cast<DOMCharacterData*>(pNodes->item(i)->getFirstChild());
if (child != NULL)
{
string key = AutoXMLCh(attribute->getAttribute(AutoXMLCh("key")));
cout << "Key: " << key << endl;
string text_string = XMLString::transcode(child->getData());
//Here I put the string and it's key value in a map so I can get
it later
AddString(key, text_string);
}
}
}_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8.
http://join.msn.com/?page=features/junkmail