Results 1 to 10 of 10

Thread: QXmlStreamReader and reading an XML with data on multiple lines

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2012
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    MacOS X Unix/X11 Windows

    Default QXmlStreamReader and reading an XML with data on multiple lines

    Hi all.

    I'm trying to read an XML file with QXmlStreamReader. To be more specific, I'm reading in a kml file. Everything has been working great so far. I can read the elements and their data. Problem is that I have one element like this:

    Qt Code:
    1. <coordinates> 122.0848938459612,37.42257124044786,17
    2. 122.0849580979198,37.42211922626856,17
    3. 122.0847469573047,37.42207183952619,17
    4. 122.0845725380962,37.42209006729676,17 </coordinates>
    To copy to clipboard, switch view to plain text mode 

    When I read the element data with reader.text() I have no newline in the data, giving me a string like this:
    Qt Code:
    1. 122.0848938459612,37.42257124044786,17122.0849580979198,37.42211922626856,17122.0847469573047,37.42207183952619,17122.0845725380962,37.42209006729676,17
    To copy to clipboard, switch view to plain text mode 

    As you can see, with out any delimiter between the different lines. And without any delimiter, there is no way to parse the data (e.g. using some kind of split function).

    Why would QXmlStreamReader not insert newlines in the data? How can we parse or handle this differently?

    Edit: for your information, I tried the kml parsing using DOM, but received the same results.
    Last edited by Kwakkie; 20th February 2013 at 12:46.

Similar Threads

  1. Reading and rereading a file with QXmlStreamReader
    By TheRonin in forum Qt Programming
    Replies: 14
    Last Post: 30th April 2015, 14:04
  2. QXmlStreamReader not reading text within tags
    By Ceaser88 in forum Newbie
    Replies: 2
    Last Post: 24th July 2011, 10:06
  3. Replies: 0
    Last Post: 26th May 2010, 19:01
  4. Replies: 3
    Last Post: 3rd April 2010, 20:35
  5. Reading non-ASCII lines from QTcpSocket via readLine()
    By joshtn in forum Qt Programming
    Replies: 1
    Last Post: 26th June 2008, 23:52


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.