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

QXmlSchemaValidator::validate without QUrl fails on Q_ASSERT

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.9.3
    • XML: QtXmlPatterns
    • None
    • 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

            Unassigned Unassigned
            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