The question is:

I have the following XML file which I believe is valid XML:

Qt Code:
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Style>3</Style>
  3. <GameVariant>5</GameVariant>
To copy to clipboard, switch view to plain text mode 

and have the following code to read it:

Qt Code:
  1. QString settingsFile = settingsDir + "/QBoardSettings.xml";
  2. QFile file(settingsFile);
  3. file.open(QIODevice::ReadOnly | QIODevice::Text);
  4. QXmlStreamReader xmlStreamReader(&file);
  5. while (xmlStreamReader.readNextStartElement()) {
  6. QString s = xmlStreamReader.name().toString();
  7. qDebug(qPrintable(s));
  8. }
To copy to clipboard, switch view to plain text mode 

But this code prints only "Style" instead of printing names for both elements. What I am doing wrong? Thanks in advance.