Results 1 to 3 of 3

Thread: QXmlStreamReader parses XML in weird order

  1. #1
    Join Date
    Jun 2010
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Symbian S60 Maemo/MeeGo

    Default QXmlStreamReader parses XML in weird order

    Hi, i have used the QXmlStreamReader before, but this time i ran into a problem i haven't seen earlier. What i basically try to do is loop through the document and for each start element i find i output (qDebug) the name of the element aswell as the line number it has been found on.

    Now the problem is that it can suddenly do this:
    line number: 2 - elementname
    line number: 3 - elementname
    line number: 4 - elementname
    line number: 109 - elementname
    line number: 110 - elementname
    line number: 5 - elementname
    line number: 6 - elementname
    line number: 7 - elementname

    What could be causing this? I tried ouputting the errors but there are no errors encountered

    Thanks in advance!

  2. #2
    Join Date
    Jun 2010
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Symbian S60 Maemo/MeeGo

    Default Re: QXmlStreamReader parses XML in weird order

    and this is basically the code that causes the ouput
    Qt Code:
    1. QByteArray returnValue = route->readAll();
    2. qDebug() << route->url();
    3. this->theReader = new QXmlStreamReader(returnValue);
    4. while(!this->theReader->atEnd()){
    5. this->theReader->readNext();
    6. if(this->theReader->isStartElement()){
    7. qDebug() << this->theReader->name().toString() << this->theReader->lineNumber();
    8. }
    9. }
    To copy to clipboard, switch view to plain text mode 

    and here is the output generated:
    [Qt Message] "MTRXML" 2
    [Qt Message] "MAPLOC" 99
    [Qt Message] "ROUTE" 3
    [Qt Message] "NAME" 357
    [Qt Message] "NAME" 358

    [Qt Message] "LENGTH" 4
    [Qt Message] "POINT" 5
    [Qt Message] "ARRIVAL" 6
    [Qt Message] "DEPARTURE" 7
    [Qt Message] "WALK" 9
    [Qt Message] "LENGTH" 10
    [Qt Message] "POINT" 11
    [Qt Message] "ARRIVAL" 12
    [Qt Message] "DEPARTURE" 13
    [Qt Message] "MAPLOC" 15
    [Qt Message] "ARRIVAL" 16
    [Qt Message] "DEPARTURE" 17
    [Qt Message] "NAME" 18
    [Qt Message] "MAPLOC" 20
    [Qt Message] "ARRIVAL" 21
    [Qt Message] "DEPARTURE" 22
    [Qt Message] "MAPLOC" 24
    [Qt Message] "ARRIVAL" 25
    [Qt Message] "DEPARTURE" 26
    [Qt Message] "NAME" 27
    [Qt Message] "MAPLOC" 29
    [Qt Message] "ARRIVAL" 30
    [Qt Message] "DEPARTURE" 31
    [Qt Message] "NAME" 32
    [Qt Message] "MAPLOC" 34
    [Qt Message] "ARRIVAL" 35
    [Qt Message] "DEPARTURE" 36
    [Qt Message] "NAME" 37
    [Qt Message] "STOP" 39
    [Qt Message] "ARRIVAL" 40
    [Qt Message] "DEPARTURE" 41
    [Qt Message] "NAME" 42
    [Qt Message] "NAME" 43
    [Qt Message] "LINE" 46
    [Qt Message] "LENGTH" 47
    [Qt Message] "STOP" 48
    [Qt Message] "ARRIVAL" 49
    [Qt Message] "DEPARTURE" 50
    [Qt Message] "NAME" 51
    [Qt Message] "NAME" 52
    [Qt Message] "STOP" 54
    [Qt Message] "ARRIVAL" 55
    [Qt Message] "DEPARTURE" 56
    [Qt Message] "NAME" 57
    [Qt Message] "NAME" 58
    [Qt Message] "STOP" 60
    [Qt Message] "ARRIVAL" 61
    [Qt Message] "DEPARTURE" 62

  3. #3
    Join Date
    Jun 2010
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Symbian S60 Maemo/MeeGo

    Default Re: QXmlStreamReader parses XML in weird order

    heres the xml, had to cut out parts of it though
    http://pastebin.com/NAPzs51w

    edit: now im starting to realise that the parser stops at line 62 when it should actually continue for hundreads of rows, what could be the cause of this, invalid format on the XML?
    Last edited by Zeddy; 23rd June 2010 at 10:12.

Similar Threads

  1. QXmlStreamReader
    By sophister in forum Qt Programming
    Replies: 6
    Last Post: 24th August 2011, 17:31
  2. Possilble Bug? QXmlStreamReader
    By dempsey001 in forum Qt Programming
    Replies: 3
    Last Post: 23rd February 2010, 18:46
  3. Need help with QXmlStreamReader
    By jknotzke in forum Qt Programming
    Replies: 2
    Last Post: 26th October 2009, 09:26
  4. QXmlStreamReader issue
    By yagabey in forum Qt Programming
    Replies: 11
    Last Post: 31st December 2008, 21:06
  5. Replies: 2
    Last Post: 7th July 2008, 08:44

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.