/usr/share/qt5/doc/qtxmlpatterns/qxmlschema.html is in qtxmlpatterns5-doc-html 5.5.1-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qxmlschema.cpp -->
<title>QXmlSchema Class | Qt XML Patterns 5.5</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<ul>
<li>Qt 5.5</li>
<li><a href="qtxmlpatterns-index.html">Qt XML Patterns</a></li>
<li><a href="qtxmlpatterns-module.html">C++ Classes</a></li>
<li>QXmlSchema</li>
<li id="buildversion">Qt 5.5.1 Reference Documentation</li>
</ul>
</div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#xml-schema-version">XML Schema Version</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QXmlSchema Class</h1>
<!-- $$$QXmlSchema-brief -->
<p>The <a href="qxmlschema.html">QXmlSchema</a> class provides loading and validation of a W3C XML Schema. <a href="#details">More...</a></p>
<!-- @@@QXmlSchema -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QXmlSchema></span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += xmlpatterns</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 4.6</td></tr></table></div><p><b>Note:</b> All functions in this class are reentrant.</p>
<ul>
<li><a href="qxmlschema-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qxmlschema.html#QXmlSchema">QXmlSchema</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qxmlschema.html#QXmlSchema-2">QXmlSchema</a></b>(const QXmlSchema &<i> other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qxmlschema.html#dtor.QXmlSchema">~QXmlSchema</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QUrl </td><td class="memItemRight bottomAlign"><b><a href="qxmlschema.html#documentUri">documentUri</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qxmlschema.html#isValid">isValid</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qxmlschema.html#load">load</a></b>(const QUrl &<i> source</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qxmlschema.html#load-2">load</a></b>(QIODevice *<i> source</i>, const QUrl &<i> documentUri</i> = QUrl())</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qxmlschema.html#load-3">load</a></b>(const QByteArray &<i> data</i>, const QUrl &<i> documentUri</i> = QUrl())</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAbstractMessageHandler * </td><td class="memItemRight bottomAlign"><b><a href="qxmlschema.html#messageHandler">messageHandler</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QXmlNamePool </td><td class="memItemRight bottomAlign"><b><a href="qxmlschema.html#namePool">namePool</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QNetworkAccessManager * </td><td class="memItemRight bottomAlign"><b><a href="qxmlschema.html#networkAccessManager">networkAccessManager</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qxmlschema.html#setMessageHandler">setMessageHandler</a></b>(QAbstractMessageHandler *<i> handler</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qxmlschema.html#setNetworkAccessManager">setNetworkAccessManager</a></b>(QNetworkAccessManager *<i> manager</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qxmlschema.html#setUriResolver">setUriResolver</a></b>(const QAbstractUriResolver *<i> resolver</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QAbstractUriResolver * </td><td class="memItemRight bottomAlign"><b><a href="qxmlschema.html#uriResolver">uriResolver</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QXmlSchema & </td><td class="memItemRight bottomAlign"><b><a href="qxmlschema.html#operator-eq">operator=</a></b>(const QXmlSchema &<i> other</i>)</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QXmlSchema-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qxmlschema.html">QXmlSchema</a> class provides loading and validation of a W3C XML Schema.</p>
<p>The <a href="qxmlschema.html">QXmlSchema</a> class loads, compiles and validates W3C XML Schema files that can be used further for validation of XML instance documents via <a href="qxmlschemavalidator.html">QXmlSchemaValidator</a>.</p>
<p>The following example shows how to load a XML Schema file from the network and test whether it is a valid schema document:</p>
<pre class="cpp"> <span class="type">QUrl</span> url(<span class="string">"http://www.schema-example.org/myschema.xsd"</span>);
<span class="type"><a href="qxmlschema.html#QXmlSchema">QXmlSchema</a></span> schema;
<span class="keyword">if</span> (schema<span class="operator">.</span>load(url) <span class="operator">=</span><span class="operator">=</span> <span class="keyword">true</span>)
qDebug() <span class="operator"><</span><span class="operator"><</span> <span class="string">"schema is valid"</span>;
<span class="keyword">else</span>
qDebug() <span class="operator"><</span><span class="operator"><</span> <span class="string">"schema is invalid"</span>;</pre>
<a name="xml-schema-version"></a>
<h3 >XML Schema Version</h3>
<p>This class is used to represent schemas that conform to the XML Schema 1.0 specification.</p>
</div>
<p><b>See also </b><a href="qxmlschemavalidator.html">QXmlSchemaValidator</a> and <a href="qtxmlpatterns-schema-example.html">XML Schema Validation Example</a>.</p>
<!-- @@@QXmlSchema -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QXmlSchema[overload1]$$$QXmlSchema -->
<h3 class="fn" id="QXmlSchema"><a name="QXmlSchema"></a>QXmlSchema::<span class="name">QXmlSchema</span>()</h3>
<p>Constructs an invalid, empty schema that cannot be used until <a href="qxmlschema.html#load">load</a>() is called.</p>
<!-- @@@QXmlSchema -->
<!-- $$$QXmlSchema$$$QXmlSchemaconstQXmlSchema& -->
<h3 class="fn" id="QXmlSchema-2"><a name="QXmlSchema-2"></a>QXmlSchema::<span class="name">QXmlSchema</span>(const <span class="type"><a href="qxmlschema.html#QXmlSchema">QXmlSchema</a></span> &<i> other</i>)</h3>
<p>Constructs a <a href="qxmlschema.html">QXmlSchema</a> that is a copy of <i>other</i>. The new instance will share resources with the existing schema to the extent possible.</p>
<!-- @@@QXmlSchema -->
<!-- $$$~QXmlSchema[overload1]$$$~QXmlSchema -->
<h3 class="fn" id="dtor.QXmlSchema"><a name="dtor.QXmlSchema"></a>QXmlSchema::<span class="name">~QXmlSchema</span>()</h3>
<p>Destroys this <a href="qxmlschema.html">QXmlSchema</a>.</p>
<!-- @@@~QXmlSchema -->
<!-- $$$documentUri[overload1]$$$documentUri -->
<h3 class="fn" id="documentUri"><a name="documentUri"></a><span class="type">QUrl</span> QXmlSchema::<span class="name">documentUri</span>() const</h3>
<p>Returns the document URI of the schema or an empty URI if no schema has been set.</p>
<!-- @@@documentUri -->
<!-- $$$isValid[overload1]$$$isValid -->
<h3 class="fn" id="isValid"><a name="isValid"></a><span class="type">bool</span> QXmlSchema::<span class="name">isValid</span>() const</h3>
<p>Returns true if this schema is valid. Examples of invalid schemas are ones that contain syntax errors or that do not conform the W3C XML Schema specification.</p>
<!-- @@@isValid -->
<!-- $$$load[overload1]$$$loadconstQUrl& -->
<h3 class="fn" id="load"><a name="load"></a><span class="type">bool</span> QXmlSchema::<span class="name">load</span>(const <span class="type">QUrl</span> &<i> source</i>)</h3>
<p>Sets this <a href="qxmlschema.html">QXmlSchema</a> to a schema loaded from the <i>source</i> URI.</p>
<p>If the schema <a href="qxmlschema.html#isValid">is invalid</a>, <code>false</code> is returned and the behavior is undefined.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type">QUrl</span> url(<span class="string">"http://www.schema-example.org/myschema.xsd"</span>);
<span class="type"><a href="qxmlschema.html#QXmlSchema">QXmlSchema</a></span> schema;
<span class="keyword">if</span> (schema<span class="operator">.</span>load(url) <span class="operator">=</span><span class="operator">=</span> <span class="keyword">true</span>)
qDebug() <span class="operator"><</span><span class="operator"><</span> <span class="string">"schema is valid"</span>;
<span class="keyword">else</span>
qDebug() <span class="operator"><</span><span class="operator"><</span> <span class="string">"schema is invalid"</span>;</pre>
<p><b>See also </b><a href="qxmlschema.html#isValid">isValid</a>().</p>
<!-- @@@load -->
<!-- $$$load$$$loadQIODevice*constQUrl& -->
<h3 class="fn" id="load-2"><a name="load-2"></a><span class="type">bool</span> QXmlSchema::<span class="name">load</span>(<span class="type">QIODevice</span> *<i> source</i>, const <span class="type">QUrl</span> &<i> documentUri</i> = QUrl())</h3>
<p>Sets this <a href="qxmlschema.html">QXmlSchema</a> to a schema read from the <i>source</i> device. The device must have been opened with at least QIODevice::ReadOnly.</p>
<p><i>documentUri</i> represents the schema obtained from the <i>source</i> device. It is the base URI of the schema, that is used internally to resolve relative URIs that appear in the schema, and for message reporting.</p>
<p>If <i>source</i> is <code>null</code> or not readable, or if <i>documentUri</i> is not a valid URI, behavior is undefined.</p>
<p>If the schema <a href="qxmlschema.html#isValid">is invalid</a>, <code>false</code> is returned and the behavior is undefined.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type">QFile</span> file(<span class="string">"myschema.xsd"</span>);
file<span class="operator">.</span>open(<span class="type">QIODevice</span><span class="operator">::</span>ReadOnly);
<span class="type"><a href="qxmlschema.html#QXmlSchema">QXmlSchema</a></span> schema;
schema<span class="operator">.</span>load(<span class="operator">&</span>file<span class="operator">,</span> <span class="type">QUrl</span><span class="operator">::</span>fromLocalFile(file<span class="operator">.</span>fileName()));
<span class="keyword">if</span> (schema<span class="operator">.</span>isValid())
qDebug() <span class="operator"><</span><span class="operator"><</span> <span class="string">"schema is valid"</span>;
<span class="keyword">else</span>
qDebug() <span class="operator"><</span><span class="operator"><</span> <span class="string">"schema is invalid"</span>;</pre>
<p><b>See also </b><a href="qxmlschema.html#isValid">isValid</a>().</p>
<!-- @@@load -->
<!-- $$$load$$$loadconstQByteArray&constQUrl& -->
<h3 class="fn" id="load-3"><a name="load-3"></a><span class="type">bool</span> QXmlSchema::<span class="name">load</span>(const <span class="type">QByteArray</span> &<i> data</i>, const <span class="type">QUrl</span> &<i> documentUri</i> = QUrl())</h3>
<p>Sets this <a href="qxmlschema.html">QXmlSchema</a> to a schema read from the <i>data</i></p>
<p><i>documentUri</i> represents the schema obtained from the <i>data</i>. It is the base URI of the schema, that is used internally to resolve relative URIs that appear in the schema, and for message reporting.</p>
<p>If <i>documentUri</i> is not a valid URI, behavior is undefined.</p>
<p>If the schema <a href="qxmlschema.html#isValid">is invalid</a>, <code>false</code> is returned and the behavior is undefined.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type">QByteArray</span> data( <span class="string">"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"</span>
<span class="string">"<xsd:schema"</span>
<span class="string">" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""</span>
<span class="string">" xmlns=\"http://www.qt-project.org/xmlschematest\""</span>
<span class="string">" targetNamespace=\"http://www.qt-project.org/xmlschematest\""</span>
<span class="string">" version=\"1.0\""</span>
<span class="string">" elementFormDefault=\"qualified\">"</span>
<span class="string">"</xsd:schema>"</span> );
<span class="type"><a href="qxmlschema.html#QXmlSchema">QXmlSchema</a></span> schema;
schema<span class="operator">.</span>load(data);
<span class="keyword">if</span> (schema<span class="operator">.</span>isValid())
qDebug() <span class="operator"><</span><span class="operator"><</span> <span class="string">"schema is valid"</span>;
<span class="keyword">else</span>
qDebug() <span class="operator"><</span><span class="operator"><</span> <span class="string">"schema is invalid"</span>;</pre>
<p><b>See also </b><a href="qxmlschema.html#isValid">isValid</a>() and <a href="qxmlschema.html#isValid">isValid</a>().</p>
<!-- @@@load -->
<!-- $$$messageHandler[overload1]$$$messageHandler -->
<h3 class="fn" id="messageHandler"><a name="messageHandler"></a><span class="type"><a href="qabstractmessagehandler.html">QAbstractMessageHandler</a></span> * QXmlSchema::<span class="name">messageHandler</span>() const</h3>
<p>Returns the message handler that handles compile and validation messages for this <a href="qxmlschema.html">QXmlSchema</a>.</p>
<p><b>See also </b><a href="qxmlschema.html#setMessageHandler">setMessageHandler</a>().</p>
<!-- @@@messageHandler -->
<!-- $$$namePool[overload1]$$$namePool -->
<h3 class="fn" id="namePool"><a name="namePool"></a><span class="type"><a href="qxmlnamepool.html">QXmlNamePool</a></span> QXmlSchema::<span class="name">namePool</span>() const</h3>
<p>Returns the name pool used by this <a href="qxmlschema.html">QXmlSchema</a> for constructing <a href="qxmlname.html">names</a>. There is no setter for the name pool, because mixing name pools causes errors due to name confusion.</p>
<!-- @@@namePool -->
<!-- $$$networkAccessManager[overload1]$$$networkAccessManager -->
<h3 class="fn" id="networkAccessManager"><a name="networkAccessManager"></a><span class="type">QNetworkAccessManager</span> * QXmlSchema::<span class="name">networkAccessManager</span>() const</h3>
<p>Returns the network manager, or 0 if it has not been set.</p>
<p><b>See also </b><a href="qxmlschema.html#setNetworkAccessManager">setNetworkAccessManager</a>().</p>
<!-- @@@networkAccessManager -->
<!-- $$$setMessageHandler[overload1]$$$setMessageHandlerQAbstractMessageHandler* -->
<h3 class="fn" id="setMessageHandler"><a name="setMessageHandler"></a><span class="type">void</span> QXmlSchema::<span class="name">setMessageHandler</span>(<span class="type"><a href="qabstractmessagehandler.html">QAbstractMessageHandler</a></span> *<i> handler</i>)</h3>
<p>Changes the <a href="qabstractmessagehandler.html">message handler</a> for this <a href="qxmlschema.html">QXmlSchema</a> to <i>handler</i>. The schema sends all compile and validation messages to this message handler. <a href="qxmlschema.html">QXmlSchema</a> does not take ownership of <i>handler</i>.</p>
<p>Normally, the default message handler is sufficient. It writes compile and validation messages to <i>stderr</i>. The default message handler includes color codes if <i>stderr</i> can render colors.</p>
<p>When <a href="qxmlschema.html">QXmlSchema</a> calls <a href="qabstractmessagehandler.html#message">QAbstractMessageHandler::message</a>(), the arguments are as follows:</p>
<div class="table"><table class="generic">
<thead><tr class="qt-style"><th >message() argument</th><th >Semantics</th></tr></thead>
<tr valign="top" class="odd"><td >QtMsgType type</td><td >Only QtWarningMsg and QtFatalMsg are used. The former identifies a warning, while the latter identifies an error.</td></tr>
<tr valign="top" class="even"><td >const QString & description</td><td >An XHTML document which is the actual message. It is translated into the current language.</td></tr>
<tr valign="top" class="odd"><td >const QUrl &identifier</td><td >Identifies the error with a URI, where the fragment is the error code, and the rest of the URI is the error namespace.</td></tr>
<tr valign="top" class="even"><td >const <a href="qsourcelocation.html">QSourceLocation</a> & sourceLocation</td><td >Identifies where the error occurred.</td></tr>
</table></div>
<p><b>See also </b><a href="qxmlschema.html#messageHandler">messageHandler</a>().</p>
<!-- @@@setMessageHandler -->
<!-- $$$setNetworkAccessManager[overload1]$$$setNetworkAccessManagerQNetworkAccessManager* -->
<h3 class="fn" id="setNetworkAccessManager"><a name="setNetworkAccessManager"></a><span class="type">void</span> QXmlSchema::<span class="name">setNetworkAccessManager</span>(<span class="type">QNetworkAccessManager</span> *<i> manager</i>)</h3>
<p>Sets the network manager to <i>manager</i>. <a href="qxmlschema.html">QXmlSchema</a> does not take ownership of <i>manager</i>.</p>
<p><b>See also </b><a href="qxmlschema.html#networkAccessManager">networkAccessManager</a>().</p>
<!-- @@@setNetworkAccessManager -->
<!-- $$$setUriResolver[overload1]$$$setUriResolverconstQAbstractUriResolver* -->
<h3 class="fn" id="setUriResolver"><a name="setUriResolver"></a><span class="type">void</span> QXmlSchema::<span class="name">setUriResolver</span>(const <span class="type"><a href="qabstracturiresolver.html">QAbstractUriResolver</a></span> *<i> resolver</i>)</h3>
<p>Sets the URI resolver to <i>resolver</i>. <a href="qxmlschema.html">QXmlSchema</a> does not take ownership of <i>resolver</i>.</p>
<p><b>See also </b><a href="qxmlschema.html#uriResolver">uriResolver</a>().</p>
<!-- @@@setUriResolver -->
<!-- $$$uriResolver[overload1]$$$uriResolver -->
<h3 class="fn" id="uriResolver"><a name="uriResolver"></a>const <span class="type"><a href="qabstracturiresolver.html">QAbstractUriResolver</a></span> * QXmlSchema::<span class="name">uriResolver</span>() const</h3>
<p>Returns the schema's URI resolver. If no URI resolver has been set, Qt XML Patterns will use the URIs in schemas as they are.</p>
<p>The URI resolver provides a level of abstraction, or <i>polymorphic URIs</i>. A resolver can rewrite <i>logical</i> URIs to physical ones, or it can translate obsolete or invalid URIs to valid ones.</p>
<p>When Qt XML Patterns calls <a href="qabstracturiresolver.html#resolve">QAbstractUriResolver::resolve</a>() the absolute URI is the URI mandated by the schema specification, and the relative URI is the URI specified by the user.</p>
<p><b>See also </b><a href="qxmlschema.html#setUriResolver">setUriResolver</a>().</p>
<!-- @@@uriResolver -->
<!-- $$$operator=[overload1]$$$operator=constQXmlSchema& -->
<h3 class="fn" id="operator-eq"><a name="operator-eq"></a><span class="type"><a href="qxmlschema.html#QXmlSchema">QXmlSchema</a></span> & QXmlSchema::<span class="name">operator=</span>(const <span class="type"><a href="qxmlschema.html#QXmlSchema">QXmlSchema</a></span> &<i> other</i>)</h3>
<p>Copies the resources of <i>other</i> into this instance, sharing them to the extent possible.</p>
<p>This function was introduced in Qt 5.4.</p>
<!-- @@@operator= -->
</div>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2015 The Qt Company Ltd.
Documentation contributions included herein are the copyrights of
their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. </p>
</div>
</body>
</html>
|