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. QXmlValidatorTest.pro
          0.9 kB
        2. main.cpp
          0.9 kB
        3. resources.qrc
          0.2 kB
        4. schema-def-slow.xsd
          0.7 kB
        5. schema-def-slower.xsd
          0.6 kB
        6. schema-def.xsd
          0.5 kB
        7. schema.xml
          0.1 kB

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: