Skip to content

PythonQt.QtXmlPatterns.QXmlSchemaValidator

QXmlSchemaValidator

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

The QXmlSchemaValidator class loads, parses an XML instance document and validates it against a W3C XML Schema that has been compiled with QXmlSchema.

The following example shows how to load a XML Schema from a local file, check whether it is a valid schema document and use it for validation of an XML instance document:

    QUrl schemaUrl("file:///home/user/schema.xsd");

    QXmlSchema schema;
    schema.load(schemaUrl);

    if (schema.isValid()) {
        QFile file("test.xml");
        file.open(QIODevice::ReadOnly);

        QXmlSchemaValidator validator(schema);
        if (validator.validate(&file, QUrl::fromLocalFile(file.fileName())))
            qDebug() << "instance document is valid";
        else
            qDebug() << "instance document is invalid";
    }

XML Schema Version

This class implements schema validation according to the XML Schema 1.0 specification.

Source: https://doc.qt.io/archives/qt-5.15/qxmlschemavalidator.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
messageHandler function (self) -> Any X.messageHandler() -> PythonQt.QtXmlPatterns.QAbstractMessageHandler
namePool function (self) -> Any X.namePool() -> PythonQt.QtXmlPatterns.QXmlNamePool
networkAccessManager function (self) -> Any X.networkAccessManager() -> PythonQt.QtNetwork.QNetworkAccessManager
setMessageHandler function (self, handler: Any) -> None Changes the [message handler](https://doc.qt.io/archives/qt-5.15/qabstractmessagehandler.html) for this [QXmlSchemaValidator](https://doc.qt.io/archives/qt-5.15/qxmlschemavalidator.html) to handler.
setNetworkAccessManager function (self, networkmanager: Any) -> Any Sets the network manager to manager.
setSchema function (self, schema: Any) -> None Sets the schema that shall be used for further validation.
setUriResolver function (self, resolver: Any) -> None Sets the URI resolver to resolver.
uriResolver function (self) -> Any X.uriResolver() -> PythonQt.QtXmlPatterns.QAbstractUriResolver
validate function (self, source: Any, documentUri: Any) -> bool X.validate(source, documentUri) -> bool