Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-74157

QXmlSchemaValidator quickly becomes very slow under certain schema conditions

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 5.9, 5.12.0, 5.12.1
    • XML: QtXmlPatterns
    • None
    • Intel(R) Xeon(R) CPU E3-1535M v6 @ 3.10 GHz
      32 GB RAM
      Windows 10 Enterprise 64-bit
      Qt 5.12.0 MSVC2017 64-bit
    • Windows

    Description

      I've ran into a case of a XSD which causes the QXmlSchemaValidator to become very (!!) slow. This seems to be independent of the size of the schema being validated. It does seem to be related to the use of the <xs:all> element in the XSD.

      I could work around this, however, I don't think this is desired behavior.

      I've created a sample project which shows the validation time rapidly increasing depending of the amount of children the <xs:all> element in the schema definition counts. The <xs:all> element containing only 6 different possible children already causes the QXmlSchemaValidator to be too slow to work with.

      In the sample project I validate only one distinct schema against slightly different schema definitions.

      The output of the sample project I created and attached:

      ======================================

      Schema ":/schema-def.xsd" valid: true

      XML valid: true

      Validation took: 7 ms

      ======================================

      Schema ":/schema-def-slower.xsd" valid: true

      XML valid: true

      Validation took: 1197 ms

      ======================================

      Schema ":/schema-def-slow.xsd" valid: true

      XML valid: true

      Validation took: 136634 ms

      Attachments

        1. schema-def-slower.xsd
          0.6 kB
        2. schema-def-slow.xsd
          0.7 kB
        3. schema-def.xsd
          0.5 kB
        4. schema.xml
          0.1 kB
        5. resources.qrc
          0.2 kB
        6. QXmlValidatorTest.pro
          0.9 kB
        7. main.cpp
          0.9 kB

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              Unassigned Unassigned
              arjen Arjen Hoogesteger
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes