<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1555" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>Hi All,</DIV>
<DIV> </DIV>
<DIV>I have been experimenting with a new game-file format for</DIV>
<DIV>KGoldrunner which will have all levels of one game in a</DIV>
<DIV>single text-file. Using XML, my format is ...</DIV>
<DIV> </DIV>
<DIV><KGoldrunnerGame></DIV>
<DIV> <Header attribute=
...>description-text</Header></DIV>
<DIV> <Level
N="001"><Layout>layout-codes</Layout></DIV>
<DIV>
<Name>name-text</Name><Hint>hint-text</Hint></DIV>
<DIV> </Level></DIV>
<DIV> <Level N="002"> ... etc.</DIV>
<DIV> </DIV>
<DIV> </KGoldrunnerGame></DIV>
<DIV> </DIV>
<DIV>The problem is that "description-text", "name-text" and</DIV>
<DIV>"hint-text" could contain white space, multi-byte UTF-8</DIV>
<DIV>strings (such as "u" with umlaut) and rich-text formatting</DIV>
<DIV>tags such as
<b>bold-text</b>, <em>emphasised</em></DIV>
<DIV>or <p>paragraph-text</p>. Some hints are several</DIV>
<DIV>paragraphs long ...</DIV>
<DIV> </DIV>
<DIV>Using QDomDocument and QDomElement, it is fairly easy</DIV>
<DIV>to find a level by number and extract "layout-codes", "name-text"</DIV>
<DIV>and "hint-text", *but* it appears that QDomElement::text() is the</DIV>
<DIV>only function that gets the text between tag-pairs like <Hint>
...</DIV>
<DIV></Hint> and it converts everything to a QString in Unicode.</DIV>
<DIV> </DIV>
<DIV>What I really want is is a function which will give me all</DIV>
<DIV>the raw text as a QByteArray in its original UTF-8 encoding.</DIV>
<DIV>That is what I need to pass to the translators at build-time</DIV>
<DIV>and to the translation process "i18n()" at run time.</DIV>
<DIV> </DIV>
<DIV>I can use QDomElement::text().toUtf8(). It gets back a "u"</DIV>
<DIV>with umlaut in 2 bytes as expected, but I am not sure I get</DIV>
<DIV>back all my whitespace and I certainly *lose* the format tags.</DIV>
<DIV> </DIV>
<DIV>Is there some simple way to get back all my original text</DIV>
<DIV>without alterations? Or should I abandon XML, use some</DIV>
<DIV>simple home-grown format and hand-code the parsing? Or</DIV>
<DIV>maybe use KSimpleConfig?</DIV>
<DIV> </DIV>
<DIV>Hoping someone can advise me,</DIV>
<DIV> </DIV>
<DIV>Cheers, Ian W.</DIV></BODY></HTML>