title: Parsing XML with nodes containing HTML in Qt
body: <p>I try to parse an XML file with some nodes containing HTML in Qt, it looks like this:</p>
  
  <pre><code>&lt;root&gt;
   &lt;list&gt;
    &lt;element&gt;Some &lt;i&gt;text&lt;i&gt;&lt;/element&gt;
    &lt;element&gt;&lt;b&gt;another line of text&lt;b&gt;&lt;/element&gt;
    &lt;element&gt;&lt;i&gt;Tag opened here&lt;/element&gt;
    &lt;element&gt;and closed here&lt;/i&gt;&lt;/element&gt;
   &lt;/list&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>I tried different approaches in Qt, but getting the HTML from the  node was somehow not possible (in an easy way).</p>
  
  <p><strong>QDomDocument</strong>: <br/>
  The only way I found to get the text of a QDomElement:
  Use the save() function (<a href="http://doc.qt.nokia.com/latest/qdomnode.html#save" rel="nofollow">documentation</a>), but then I would get the whole line "&lt;element&gt;...&lt;/element&gt;", not just the inner text.</p>
  
  <p><strong>QXmlStreamReader</strong> <br/>
  There is the function readElementText(QXmlStreamReader::IncludeChildElements) (<a href="http://doc.qt.nokia.com/4.7-snapshot/qxmlstreamreader.html#readElementText" rel="nofollow">documentation</a>), but it removes the HTML tags, so the text of the first example would be only "Some text".</p>
  
  <p>Can this be done in a more effective way?</p>
  
  <p>I thought of another solution, what do you think about it:</p>
  
  <p>How about wrapping the contents of the &lt;element&gt; tags in CDATA sections (using string replace or regex functions) before the xml file is parsed?</p>