Sophie

Sophie

distrib > Mageia > 6 > armv7hl > media > core-updates > by-pkgid > 9026c9fecbedd778b04292bd6f2d9049 > files > 97

qtxmlpatterns5-doc-5.9.4-1.mga6.noarch.rpm

<?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.9</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.9</td><td ><a href="qtxmlpatterns-index.html">Qt XML Patterns</a></td><td ><a href="qtxmlpatterns-module.html">C++ Classes</a></td><td >QXmlSchema</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td>
        </tr></table>
      </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 &lt;QXmlSchema&gt;</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><ul>
<li><a href="qxmlschema-members.html">List of all members, including inherited members</a></li>
</ul>
<p><b>Note:</b> All functions in this class are reentrant.</p>
<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-1">QXmlSchema</a></b>(const QXmlSchema &amp;<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 &amp;<i>source</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qxmlschema.html#load-1">load</a></b>(QIODevice *<i>source</i>, const QUrl &amp;<i>documentUri</i> = QUrl())</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qxmlschema.html#load-2">load</a></b>(const QByteArray &amp;<i>data</i>, const QUrl &amp;<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 &amp;</td><td class="memItemRight bottomAlign"><b><a href="qxmlschema.html#operator-eq">operator=</a></b>(const QXmlSchema &amp;<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">&quot;http://www.schema-example.org/myschema.xsd&quot;</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">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;schema is valid&quot;</span>;
      <span class="keyword">else</span>
          qDebug() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;schema is invalid&quot;</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-1"><a name="QXmlSchema-1"></a>QXmlSchema::<span class="name">QXmlSchema</span>(const <span class="type"><a href="qxmlschema.html#QXmlSchema">QXmlSchema</a></span> &amp;<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> &amp;<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">&quot;http://www.schema-example.org/myschema.xsd&quot;</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">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;schema is valid&quot;</span>;
      <span class="keyword">else</span>
          qDebug() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;schema is invalid&quot;</span>;

</pre>
<p><b>See also </b><a href="qxmlschema.html#isValid">isValid</a>().</p>
<!-- @@@load -->
<!-- $$$load$$$loadQIODevice*constQUrl& -->
<h3 class="fn" id="load-1"><a name="load-1"></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> &amp;<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">&quot;myschema.xsd&quot;</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">&amp;</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">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;schema is valid&quot;</span>;
      <span class="keyword">else</span>
          qDebug() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;schema is invalid&quot;</span>;

</pre>
<p><b>See also </b><a href="qxmlschema.html#isValid">isValid</a>().</p>
<!-- @@@load -->
<!-- $$$load$$$loadconstQByteArray&constQUrl& -->
<h3 class="fn" id="load-2"><a name="load-2"></a><span class="type">bool</span> QXmlSchema::<span class="name">load</span>(const <span class="type">QByteArray</span> &amp;<i>data</i>, const <span class="type">QUrl</span> &amp;<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">&quot;&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;UTF-8\&quot;?&gt;&quot;</span>
                       <span class="string">&quot;&lt;xsd:schema&quot;</span>
                       <span class="string">&quot;        xmlns:xsd=\&quot;http://www.w3.org/2001/XMLSchema\&quot;&quot;</span>
                       <span class="string">&quot;        xmlns=\&quot;http://www.qt-project.org/xmlschematest\&quot;&quot;</span>
                       <span class="string">&quot;        targetNamespace=\&quot;http://www.qt-project.org/xmlschematest\&quot;&quot;</span>
                       <span class="string">&quot;        version=\&quot;1.0\&quot;&quot;</span>
                       <span class="string">&quot;        elementFormDefault=\&quot;qualified\&quot;&gt;&quot;</span>
                       <span class="string">&quot;&lt;/xsd:schema&gt;&quot;</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">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;schema is valid&quot;</span>;
      <span class="keyword">else</span>
          qDebug() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;schema is invalid&quot;</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 &amp; 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 &amp;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> &amp; 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> &amp;QXmlSchema::<span class="name">operator=</span>(const <span class="type"><a href="qxmlschema.html#QXmlSchema">QXmlSchema</a></span> &amp;<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">&copy;</acronym> 2017 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>