title: Parse HTML with the QXmlStreamReader in Qt 5.8 with MSVC 2015
body: <p>I try to get some data from a webpage in Qt. Since <a href="https://stackoverflow.com/questions/18676800/how-to-parse-html-with-c-qt">QWebKit is unmaintained</a> I would like to use <code>QXmlStreamReader</code> but it I get error messages for some Webpages.</p>
  
  <p>For example: <code>XML Parse Error  "Opening and ending tag mismatch."</code> at <a href="http://www.google.com" rel="nofollow noreferrer">http://www.google.com</a></p>
  
  <pre><code>&lt;HTML&gt;&lt;HEAD&gt;&lt;meta http-equiv="content-type" content="text/html;charset=utf-8"&gt;
  &lt;TITLE&gt;302 Moved&lt;/TITLE&gt;&lt;/HEAD&gt;&lt;BODY&gt;
  &lt;H1&gt;302 Moved&lt;/H1&gt;
  The document has moved
  &lt;A HREF="http://www.google.de/?gfe_rd=cr&amp;amp;ei=toP_WMrVKoHKXuvxnsAO"&gt;here&lt;/A&gt;.
  &lt;/BODY&gt;&lt;/HTML&gt;
  </code></pre>
  
  <p>And I get <code>HTML</code>, <code>HEAD</code>, <code>meta</code> and <code>TITLE</code>. </p>
  
  <p>Other error messages on valid html pages:</p>
  
  <ul>
  <li>XML Parse Error  "Expected '-' or 'DOCTYPE', but got '[a-zA-Z]'."</li>
  <li>XML Parse Error  "Entity 'raquo' not declared."</li>
  </ul>
  
  <p>Here is my Code:</p>
  
  <pre><code>webpage = new QXmlStreamReader(data);
  
  //emit got_webpage(&amp;QString(data));
  
  QStringList test;
  
  while (!webpage-&gt;atEnd() &amp;&amp; !webpage-&gt;hasError())
  {
      QXmlStreamReader::TokenType token = webpage-&gt;readNext();
  
      if (token == QXmlStreamReader::StartDocument)
          continue;
  
      if (token == QXmlStreamReader::StartElement)
      {
          test &lt;&lt; webpage-&gt;name().toString();
          /*if (webpage-&gt;name() == "H1")
          {
              emit got_webpage(webpage)
          }*/
      }
  }
  
  emit got_webpage(&amp;test.join("\n"));
  
  if (webpage-&gt;hasError())
  {
      // TODO: Error handling...
      qDebug() &lt;&lt; "XML Parse Error " &lt;&lt; webpage-&gt;errorString();
  }
  
  webpage-&gt;clear();
  delete webpage;
  </code></pre>