Proper successor for QXmlSchemaValidator?



  • Hi,

    I am using QXmlStreamReader (https://doc.qt.io/qt-5/qxmlstreamreader.html) and QXmlStreamWriter for a while now since the Qt documentation discourages to use QDom stuff (https://doc.qt.io/qt-5/qtxml-index.html), I am quite happy with it, but now I would like to profit from xml schemata to have a better control of what happens with my xml files. Naturally I would use the QXmlSchemaValidator (https://doc.qt.io/qt-5/qxmlschemavalidator.html) and its related classes to handle that, but it seems that the Xml pattern module has been set to deprecated for Qt 5.13 (https://wiki.qt.io/New_Features_in_Qt_5.13 ). Since I intend to use that code for a while I would prefer to use classes which will not get removed in the foreseeable future, but I do not find anything in the documentation.

    Therefore my question to the specialists: what is a proper Qt way to handle Xml Schemata and such in 2019? Many thanks in advance for your help!



  • I am curious as to what will happen here as well. I use QXmlQuery to parse my xml data. The other solutions in the wild are huge behemoths of code I would rather that include in my project. I don't know of any lightweight xslt processors out there.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    That a question better asked on the interest mailing list. You'll find there Qt's developers/maintainers. This forum is more user oriented.



  • Hi,

    thanks for your answers, I will try the mailing list then...



  • A colleague asked for me on the mailing list and that was the answer:

    regarding the 'deprecated' state of XmlPatterns: There wont be an further development for this module, but I also doubt that it will be removed before Qt 6. So as long as you're using Qt 5 you're safe to use XmlPatterns. Qt 6 might be still 2 years away, and as you're using it professionally, I assume that you'll probably wait at least till the release of Qt 6.1 (or even longer) anyway before upgrading your project to it. Until then there might be another Qt (conforming) solution to the problem.

    So in my opinion you've got 2 options (depending on the scope and lifecycle of your project):
    a) use the Xml Schema related classes from the XmlPatterns module and worry about it going away (much) later, and maybe even have a Qt (conforming) solution by then, or
    b) use an external library like CodeSynthesis XSD or something similar and worry about their API changes and usage and naming patterns that differ from Qt's patterns etc.

    IMHO using the Qt modules while they are still available is usually the better option.

    [[by Yves Maurischat]]

    I hope that helps other developers with similar questions. I mark this as solved in the sense that there is some sort of answer here, although maybe it's not completely satisfying.


  • Banned

    This post is deleted!