Priority: P2: Important
Affects Version/s: 5.9.1
Component/s: XML: Stream Reader/Writer
Environment:* MacOs 10.13
* Windows 10 (VS 2015)
Scenario: reading an xml file with QXmlStreamReader and writing every (unmodified) token to another file with QXmlStreamWriter.
Expected: output should equal input. Actual:
Note that the xmlns attribute was moved to the "father" tag. If any whitespace (space, tab, newline) is added after the "father" tag, namespace is correctly placed in the "child" tag. Tags and namespaces seem to be read correctly by the QXmlStreamReader.
The problem can be reproduced with the XML Stream Lint Example from Qt docs and the attached xml file.
If confirmed, this is a severe issue for any applications using xml data.
Also note other small problems:
- "standalone" attribute is removed from the start token;
- the first newline is arbitrarily removed
A workaround to 1. is to handle the startDocument token explicitly:
Side note: the reader API returns QStringRef while the writer takes const QString, thus requiring an unnecessary copy for every string ref.