title: Reading an XML file using QXmlStreamReader
body: <p>I want to read an XML file using <code>QXmlStreamReader</code>, but I really don't know where the problem is. My function reads the content of the first tag, but then it stops.</p>
  
  <p>The form of the XML file:</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;student&gt;
          &lt;firstName&gt;mina&lt;/firstName&gt; 
          &lt;lastName&gt;jina&lt;/lastName&gt;
          &lt;grade&gt;13&lt;/grade&gt;
      &lt;/student&gt;
      &lt;student&gt;
          &lt;firstName&gt;Cina&lt;/firstName&gt; 
          &lt;lastName&gt;fina&lt;/lastName&gt;
          &lt;grade&gt;13&lt;/grade&gt;
      &lt;/student&gt;
  </code></pre>
  
  <p>The function:</p>
  
  <pre><code>void MainWindow::open() {
      QFile file(QFileDialog::getOpenFileName(this,"Open"));
      if(file.open(QIODevice::ReadOnly)) {
          QXmlStreamReader xmlReader;
          xmlReader.setDevice(&amp;file);
          QList&lt;Student&gt; students;
          xmlReader.readNext();
          //Reading from the file
          while (!xmlReader.isEndDocument())
          {
              if (xmlReader.isStartElement())
              {
                  QString name = xmlReader.name().toString();
                  if (name == "firstName" || name == "lastName" ||
                          name == "grade")
                  {
                      QMessageBox::information(this,name,xmlReader.readElementText());
                  }
              }else if (xmlReader.isEndElement())
              {
                  xmlReader.readNext();
              }
          }
          if (xmlReader.hasError())
          {
              std::cout &lt;&lt; "XML error: " &lt;&lt; xmlReader.errorString().data() &lt;&lt; std::endl;
          }
      }
  }
  </code></pre>