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

QXmlSchemaValidator::validate without QUrl fails on Q_ASSERT

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.9.3
    • Fix Version/s: None
    • Component/s: XML: QtXmlPatterns
    • Labels:
      None
    • Environment:
      Windows 7 64 bit Microsoft Visual Studio 2015

      Description

      I try to use QXmlSchemaValidator::validate method without QUrl and my test fails because of a QASSERT on the QUrl validity.

      The problem seems to come because QXmlSchemaValidator::validate has a default QUrl parameter and this parameter is an empty Url (not a valid one). If we must have a valid Url, it can't be a (invalid) default one.

      My test :

       

      QXmlSchema schema;
      schema.load(schemaData);
      
      QXmlSchema Validator validator(schema);
      if (!validator.validate(instanceData)))
      {
          std::cout << "Invalid xml file" << std::endl;
      }
      

      QXmlSchemaValidator.h :

      bool validate(const QByteArray &data, const QUrl &documentUri = QUrl()) const;
      

      QAccelTreeResourceLoader.cpp :

      bool AccelTreeResourceLoader::retrieveDocument(QIODevice *source, const QUrl &documentUri, const ReportContext::Ptr &context)
      {
          Q_ASSERT(source);
          Q_ASSERT(source->isReadable());
          Q_ASSERT(documentUri.isValid());
      
          ...
      }

        Attachments

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

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              antoinej Antoine Jarrier
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes