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

QXmlSchemaValidator quickly becomes very slow under certain schema conditions



    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Duplicate
    • Affects Version/s: 5.9, 5.12.0, 5.12.1
    • Fix Version/s: None
    • Component/s: XML: QtXmlPatterns
    • Labels:
    • Environment:
      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
    • Platform/s:


      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


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

          Issue Links

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



              • Assignee:
                arjen Arjen Hoogesteger
              • Votes:
                0 Vote for this issue
                2 Start watching this issue


                • Created:

                  Gerrit Reviews

                  There are no open Gerrit changes