Kwakkie
20th February 2013, 11:33
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:
<coordinates> 122.0848938459612,37.42257124044786,17
122.0849580979198,37.42211922626856,17
122.0847469573047,37.42207183952619,17
122.0845725380962,37.42209006729676,17 </coordinates>
When I read the element data with reader.text() I have no newline in the data, giving me a string like this:
122.0848938459612,37.42257124044786,17122.08495809 79198,37.42211922626856,17122.0847469573047,37.422 07183952619,17122.0845725380962,37.42209006729676, 17
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.
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:
<coordinates> 122.0848938459612,37.42257124044786,17
122.0849580979198,37.42211922626856,17
122.0847469573047,37.42207183952619,17
122.0845725380962,37.42209006729676,17 </coordinates>
When I read the element data with reader.text() I have no newline in the data, giving me a string like this:
122.0848938459612,37.42257124044786,17122.08495809 79198,37.42211922626856,17122.0847469573047,37.422 07183952619,17122.0845725380962,37.42209006729676, 17
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.