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

QXmlSchemaValidator: QAbstractUriResolver has no effect when set on the validator

XMLWordPrintable

      The documentation states that it should be possible to set a subclass of QAbstractUrlResolver on an instance of QXmlSchemaValidator in order to circumvent network access for schema (.xsd) resources. When this is tried in practice, the resolve() method of the subclass is never called.

      To work around this problem (so that a network connection is not required to use XML schema and instances together, it is necessary to create a subclass of QNetworkAccessManager and to re-implement createRequest so that it creates a network request that refers to local resources and not network resources. Network resources are embedded inside schema files but are also available to download and copy into the application run directory for local reference.

      The attached example demonstrates the work-around. However, if you uncomment the line which sets the network access manager on the validator, the code will not be able to validate the xml without a network connection.

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

            Unassigned Unassigned
            cattell Matthew Cattell (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes