[Development] HEADS-UP: Deprecating SAX classes in Qt XML

Sona Kurazyan sona.kurazyan at qt.io
Tue Nov 26 17:22:36 CET 2019

I'd like to inform everyone that the SAX classes for reading and writing XML files are about to be deprecated in Qt 5.15, and QXmlStreamReader/QXmlStreamWriter should be used instead.

As a consequence QDomDocument has been re-implemented using QXmlStreamReader, and Qt 6 will switch to the new implementation as soon as this<https://codereview.qt-project.org/c/qt/qtbase/+/279029> change propagates to dev (5.15 will still use the old implementation).

Please note that the old SAX-based implementation was not following the XML spec very strictly, whereas the new implementation does. Because of that after switching to the new QXmlStreamReader-based implementation in Qt 6, there will be slight changes of QDomDocument behavior. In particular:

- Attribute values will be normalized<https://www.w3.org/TR/xml/#AVNormalize>. For example <tag attr=" a  \n b " /> will be equivalent to <tag attr="a b"/>
- Identical qualified attribute names won't be allowed<https://www.w3.org/TR/xml/#uniqattspec> anymore, i.e. attributes of an element must have unique names.
- Undeclared namespace prefixes won't be allowed<https://www.w3.org/TR/xml-names/#nsc-NSDeclared> anymore.

If you are relying on any of these, please consider updating your code/xml files accordingly.

Best regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20191126/41baffd6/attachment.html>

More information about the Development mailing list