Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-54661

QXmlStreamReader: name of invalid element not cleared

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • None
    • 5.5.1, 5.6.1, 5.7.0
    • None

    Description

      Issue is described with following code snipet:

      QXmlStreamReader xmlReader;
      
      void xmlParse()
      {
      while(!xmlReader.atEnd()) {
              xmlReader.readNext();
              qDebug() << xmlReader.name().toString() + ": " + xmlReader.tokenString();
          }
      }
      
      int main(int argc, char *argv[])
      {
      QApplication a(argc, argv);
      xmlReader.addData("<root><element></root>");
      xmlParse();
      xmlReader.clear(); // Removes any device() or data from the reader and resets its internal state to the initial state.
      xmlReader.addData("<root><element/></root>"); // now it well-formed 
      xmlParse();
      
      return a.exec();
      }
      

      Output:
      ": StartDocument"
      "root: StartElement"
      ": Characters"
      "element: StartElement"
      ": Characters"
      "element: Invalid"
      "element: StartDocument" // element appeared as name of StartDocument token even if after first calling of xmlParse() call xmlReader.clear()
      "root: StartElement"
      ": Characters"
      "element: StartElement"
      "element: EndElement"
      ": Characters"
      "root: EndElement"
      ": EndDocument"

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            qznec Ghenady
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes