File: qxmlschemavalidator.html

package info (click to toggle)
qt4-x11 4%3A4.8.2%2Bdfsg-11
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 701,696 kB
  • sloc: cpp: 2,686,179; ansic: 375,485; python: 25,859; sh: 19,349; xml: 17,091; perl: 14,765; yacc: 5,383; asm: 5,038; makefile: 1,259; lex: 555; ruby: 526; objc: 347; cs: 112; pascal: 112; php: 54; sed: 34
file content (235 lines) | stat: -rw-r--r-- 22,779 bytes parent folder | download
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
232
233
234
235
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qxmlschemavalidator.cpp -->
  <title>Qt 4.8: QXmlSchemaValidator Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="content"> 
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
  </div>
  <div class="breadcrumb toolblock">
    <ul>
      <li class="first"><a href="index.html">Home</a></li>
      <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtxmlpatterns.html">QtXmlPatterns</a></li>
<li>QXmlSchemaValidator</li>
    </ul>
  </div>
</div>
<div class="content mainContent">
<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>
<h1 class="title">QXmlSchemaValidator Class Reference</h1>
<!-- $$$QXmlSchemaValidator-brief -->
<p>The QXmlSchemaValidator class validates XML instance documents against a W3C XML Schema. <a href="#details">More...</a></p>
<!-- @@@QXmlSchemaValidator -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QXmlSchemaValidator&gt;</span></pre><p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#reentrant">reentrant</a>.</p>
<p>This class was introduced in Qt 4.6.</p>
<ul>
<li><a href="qxmlschemavalidator-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qxmlschemavalidator.html#QXmlSchemaValidator">QXmlSchemaValidator</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qxmlschemavalidator.html#QXmlSchemaValidator-2">QXmlSchemaValidator</a></b> ( const QXmlSchema &amp; <i>schema</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qxmlschemavalidator.html#dtor.QXmlSchemaValidator">~QXmlSchemaValidator</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAbstractMessageHandler * </td><td class="memItemRight bottomAlign"><b><a href="qxmlschemavalidator.html#messageHandler">messageHandler</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QXmlNamePool </td><td class="memItemRight bottomAlign"><b><a href="qxmlschemavalidator.html#namePool">namePool</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QNetworkAccessManager * </td><td class="memItemRight bottomAlign"><b><a href="qxmlschemavalidator.html#networkAccessManager">networkAccessManager</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QXmlSchema </td><td class="memItemRight bottomAlign"><b><a href="qxmlschemavalidator.html#schema">schema</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qxmlschemavalidator.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="qxmlschemavalidator.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="qxmlschemavalidator.html#setSchema">setSchema</a></b> ( const QXmlSchema &amp; <i>schema</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qxmlschemavalidator.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="qxmlschemavalidator.html#uriResolver">uriResolver</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qxmlschemavalidator.html#validate">validate</a></b> ( const QUrl &amp; <i>source</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qxmlschemavalidator.html#validate-2">validate</a></b> ( QIODevice * <i>source</i>, const QUrl &amp; <i>documentUri</i> = QUrl() ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qxmlschemavalidator.html#validate-3">validate</a></b> ( const QByteArray &amp; <i>data</i>, const QUrl &amp; <i>documentUri</i> = QUrl() ) const</td></tr>
</table>
<a name="details"></a>
<!-- $$$QXmlSchemaValidator-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QXmlSchemaValidator class validates XML instance documents against a W3C XML Schema.</p>
<p>The QXmlSchemaValidator class loads, parses an XML instance document and validates it against a W3C XML Schema that has been compiled with <a href="qxmlschema.html">QXmlSchema</a>.</p>
<p>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:</p>
<pre class="cpp">     <span class="type"><a href="qurl.html">QUrl</a></span> schemaUrl(<span class="string">&quot;file:///home/user/schema.xsd&quot;</span>);

     <span class="type"><a href="qxmlschema.html">QXmlSchema</a></span> schema;
     schema<span class="operator">.</span>load(schemaUrl);

     <span class="keyword">if</span> (schema<span class="operator">.</span>isValid()) {
         <span class="type"><a href="qfile.html">QFile</a></span> file(<span class="string">&quot;test.xml&quot;</span>);
         file<span class="operator">.</span>open(<span class="type"><a href="qiodevice.html">QIODevice</a></span><span class="operator">::</span>ReadOnly);

         <span class="type">QXmlSchemaValidator</span> validator(schema);
         <span class="keyword">if</span> (validator<span class="operator">.</span>validate(<span class="operator">&amp;</span>file<span class="operator">,</span> <span class="type"><a href="qurl.html">QUrl</a></span><span class="operator">::</span>fromLocalFile(file<span class="operator">.</span>fileName())))
             <a href="qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;instance document is valid&quot;</span>;
         <span class="keyword">else</span>
             <a href="qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;instance document is invalid&quot;</span>;
     }</pre>
<a name="xml-schema-version"></a>
<h3>XML Schema Version</h3>
<p>This class implements schema validation according to the <a href="http://www.w3.org/XML/Schema">XML Schema</a> 1.0 specification.</p>
</div>
<p><b>See also </b><a href="qxmlschema.html">QXmlSchema</a> and <a href="xmlpatterns-schema.html">XML Schema Validation Example</a>.</p>
<!-- @@@QXmlSchemaValidator -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QXmlSchemaValidator[overload1]$$$QXmlSchemaValidator -->
<h3 class="fn"><a name="QXmlSchemaValidator"></a>QXmlSchemaValidator::<span class="name">QXmlSchemaValidator</span> ()</h3>
<p>Constructs a schema validator. The schema used for validation must be referenced in the XML instance document via the <tt>xsi:schemaLocation</tt> or <tt>xsi:noNamespaceSchemaLocation</tt> attribute.</p>
<!-- @@@QXmlSchemaValidator -->
<!-- $$$QXmlSchemaValidator$$$QXmlSchemaValidatorconstQXmlSchema& -->
<h3 class="fn"><a name="QXmlSchemaValidator-2"></a>QXmlSchemaValidator::<span class="name">QXmlSchemaValidator</span> ( const <span class="type"><a href="qxmlschema.html">QXmlSchema</a></span> &amp; <i>schema</i> )</h3>
<p>Constructs a schema validator that will use <i>schema</i> for validation. If an empty <a href="qxmlschema.html">QXmlSchema</a> schema is passed to the validator, the schema used for validation must be referenced in the XML instance document via the <tt>xsi:schemaLocation</tt> or <tt>xsi:noNamespaceSchemaLocation</tt> attribute.</p>
<!-- @@@QXmlSchemaValidator -->
<!-- $$$~QXmlSchemaValidator[overload1]$$$~QXmlSchemaValidator -->
<h3 class="fn"><a name="dtor.QXmlSchemaValidator"></a>QXmlSchemaValidator::<span class="name">~QXmlSchemaValidator</span> ()</h3>
<p>Destroys this <a href="qxmlschemavalidator.html">QXmlSchemaValidator</a>.</p>
<!-- @@@~QXmlSchemaValidator -->
<!-- $$$messageHandler[overload1]$$$messageHandler -->
<h3 class="fn"><a name="messageHandler"></a><span class="type"><a href="qabstractmessagehandler.html">QAbstractMessageHandler</a></span> * QXmlSchemaValidator::<span class="name">messageHandler</span> () const</h3>
<p>Returns the message handler that handles parsing and validation messages for this <a href="qxmlschemavalidator.html">QXmlSchemaValidator</a>.</p>
<p><b>See also </b><a href="qxmlschemavalidator.html#setMessageHandler">setMessageHandler</a>().</p>
<!-- @@@messageHandler -->
<!-- $$$namePool[overload1]$$$namePool -->
<h3 class="fn"><a name="namePool"></a><span class="type"><a href="qxmlnamepool.html">QXmlNamePool</a></span> QXmlSchemaValidator::<span class="name">namePool</span> () const</h3>
<p>Returns the name pool used by this <a href="qxmlschemavalidator.html">QXmlSchemaValidator</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"><a name="networkAccessManager"></a><span class="type"><a href="qnetworkaccessmanager.html">QNetworkAccessManager</a></span> * QXmlSchemaValidator::<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="qxmlschemavalidator.html#setNetworkAccessManager">setNetworkAccessManager</a>().</p>
<!-- @@@networkAccessManager -->
<!-- $$$schema[overload1]$$$schema -->
<h3 class="fn"><a name="schema"></a><span class="type"><a href="qxmlschema.html">QXmlSchema</a></span> QXmlSchemaValidator::<span class="name">schema</span> () const</h3>
<p>Returns the schema that is used for validation.</p>
<p><b>See also </b><a href="qxmlschemavalidator.html#setSchema">setSchema</a>().</p>
<!-- @@@schema -->
<!-- $$$setMessageHandler[overload1]$$$setMessageHandlerQAbstractMessageHandler* -->
<h3 class="fn"><a name="setMessageHandler"></a><span class="type">void</span> QXmlSchemaValidator::<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="qxmlschemavalidator.html">QXmlSchemaValidator</a> to <i>handler</i>. The schema validator sends all parsing and validation messages to this message handler. <a href="qxmlschemavalidator.html">QXmlSchemaValidator</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="qxmlschemavalidator.html">QXmlSchemaValidator</a> calls <a href="qabstractmessagehandler.html#message">QAbstractMessageHandler::message</a>(), the arguments are as follows:</p>
<table class="generic">
<thead><tr class="qt-style"><th >message() argument</th><th >Semantics</th></tr></thead>
<tr valign="top" class="odd"><td ><a href="qtglobal.html#QtMsgType-enum">QtMsgType</a> type</td><td >Only <a href="qtglobal.html#QtMsgType-enum">QtWarningMsg</a> and <a href="qtglobal.html#QtMsgType-enum">QtFatalMsg</a> are used. The former identifies a warning, while the latter identifies an error.</td></tr>
<tr valign="top" class="even"><td >const <a href="qstring.html">QString</a> &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 <a href="qurl.html">QUrl</a> &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>
<p><b>See also </b><a href="qxmlschemavalidator.html#messageHandler">messageHandler</a>().</p>
<!-- @@@setMessageHandler -->
<!-- $$$setNetworkAccessManager[overload1]$$$setNetworkAccessManagerQNetworkAccessManager* -->
<h3 class="fn"><a name="setNetworkAccessManager"></a><span class="type">void</span> QXmlSchemaValidator::<span class="name">setNetworkAccessManager</span> ( <span class="type"><a href="qnetworkaccessmanager.html">QNetworkAccessManager</a></span> * <i>manager</i> )</h3>
<p>Sets the network manager to <i>manager</i>. <a href="qxmlschemavalidator.html">QXmlSchemaValidator</a> does not take ownership of <i>manager</i>.</p>
<p><b>See also </b><a href="qxmlschemavalidator.html#networkAccessManager">networkAccessManager</a>().</p>
<!-- @@@setNetworkAccessManager -->
<!-- $$$setSchema[overload1]$$$setSchemaconstQXmlSchema& -->
<h3 class="fn"><a name="setSchema"></a><span class="type">void</span> QXmlSchemaValidator::<span class="name">setSchema</span> ( const <span class="type"><a href="qxmlschema.html">QXmlSchema</a></span> &amp; <i>schema</i> )</h3>
<p>Sets the <i>schema</i> that shall be used for further validation. If the schema is empty, the schema used for validation must be referenced in the XML instance document via the <tt>xsi:schemaLocation</tt> or <tt>xsi:noNamespaceSchemaLocation</tt> attribute.</p>
<p><b>See also </b><a href="qxmlschemavalidator.html#schema">schema</a>().</p>
<!-- @@@setSchema -->
<!-- $$$setUriResolver[overload1]$$$setUriResolverconstQAbstractUriResolver* -->
<h3 class="fn"><a name="setUriResolver"></a><span class="type">void</span> QXmlSchemaValidator::<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="qxmlschemavalidator.html">QXmlSchemaValidator</a> does not take ownership of <i>resolver</i>.</p>
<p><b>See also </b><a href="qxmlschemavalidator.html#uriResolver">uriResolver</a>().</p>
<!-- @@@setUriResolver -->
<!-- $$$uriResolver[overload1]$$$uriResolver -->
<h3 class="fn"><a name="uriResolver"></a>const <span class="type"><a href="qabstracturiresolver.html">QAbstractUriResolver</a></span> * QXmlSchemaValidator::<span class="name">uriResolver</span> () const</h3>
<p>Returns the schema's URI resolver. If no URI resolver has been set, <a href="qtxmlpatterns.html">QtXmlPatterns</a> will use the URIs in instance documents 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 <a href="qtxmlpatterns.html">QtXmlPatterns</a> 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="qxmlschemavalidator.html#setUriResolver">setUriResolver</a>().</p>
<!-- @@@uriResolver -->
<!-- $$$validate[overload1]$$$validateconstQUrl& -->
<h3 class="fn"><a name="validate"></a><span class="type">bool</span> QXmlSchemaValidator::<span class="name">validate</span> ( const <span class="type"><a href="qurl.html">QUrl</a></span> &amp; <i>source</i> ) const</h3>
<p>Validates the XML instance document read from <i>source</i> against the schema.</p>
<p>Returns <tt>true</tt> if the XML instance document is valid according to the schema, <tt>false</tt> otherwise.</p>
<p>Example:</p>
<pre class="cpp">     <span class="keyword">const</span> <span class="type"><a href="qxmlschema.html">QXmlSchema</a></span> schema <span class="operator">=</span> getSchema();

     <span class="keyword">const</span> <span class="type"><a href="qurl.html">QUrl</a></span> url(<span class="string">&quot;http://www.schema-example.org/test.xml&quot;</span>);

     <span class="type"><a href="qxmlschemavalidator.html">QXmlSchemaValidator</a></span> validator(schema);
     <span class="keyword">if</span> (validator<span class="operator">.</span>validate(url))
         <a href="qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;instance document is valid&quot;</span>;
     <span class="keyword">else</span>
         <a href="qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;instance document is invalid&quot;</span>;</pre>
<!-- @@@validate -->
<!-- $$$validate$$$validateQIODevice*constQUrl& -->
<h3 class="fn"><a name="validate-2"></a><span class="type">bool</span> QXmlSchemaValidator::<span class="name">validate</span> ( <span class="type"><a href="qiodevice.html">QIODevice</a></span> * <i>source</i>, const <span class="type"><a href="qurl.html">QUrl</a></span> &amp; <i>documentUri</i> = QUrl() ) const</h3>
<p>Validates the XML instance document read from <i>source</i> with the given <i>documentUri</i> against the schema.</p>
<p>Returns <tt>true</tt> if the XML instance document is valid according to the schema, <tt>false</tt> otherwise.</p>
<p>Example:</p>
<pre class="cpp">     <span class="keyword">const</span> <span class="type"><a href="qxmlschema.html">QXmlSchema</a></span> schema <span class="operator">=</span> getSchema();

     <span class="type"><a href="qfile.html">QFile</a></span> file(<span class="string">&quot;test.xml&quot;</span>);
     file<span class="operator">.</span>open(<span class="type"><a href="qiodevice.html">QIODevice</a></span><span class="operator">::</span>ReadOnly);

     <span class="type"><a href="qxmlschemavalidator.html">QXmlSchemaValidator</a></span> validator(schema);
     <span class="keyword">if</span> (validator<span class="operator">.</span>validate(<span class="operator">&amp;</span>file<span class="operator">,</span> <span class="type"><a href="qurl.html">QUrl</a></span><span class="operator">::</span>fromLocalFile(file<span class="operator">.</span>fileName())))
         <a href="qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;instance document is valid&quot;</span>;
     <span class="keyword">else</span>
         <a href="qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;instance document is invalid&quot;</span>;</pre>
<!-- @@@validate -->
<!-- $$$validate$$$validateconstQByteArray&constQUrl& -->
<h3 class="fn"><a name="validate-3"></a><span class="type">bool</span> QXmlSchemaValidator::<span class="name">validate</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>data</i>, const <span class="type"><a href="qurl.html">QUrl</a></span> &amp; <i>documentUri</i> = QUrl() ) const</h3>
<p>Validates the XML instance document read from <i>data</i> with the given <i>documentUri</i> against the schema.</p>
<p>Returns <tt>true</tt> if the XML instance document is valid according to the schema, <tt>false</tt> otherwise.</p>
<p>Example:</p>
<pre class="cpp">     <span class="keyword">const</span> <span class="type"><a href="qxmlschema.html">QXmlSchema</a></span> schema <span class="operator">=</span> getSchema();

     <span class="type"><a href="qbytearray.html">QByteArray</a></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;test&gt;&lt;/test&gt;&quot;</span>);

     <span class="type"><a href="qbuffer.html">QBuffer</a></span> buffer(<span class="operator">&amp;</span>data);
     buffer<span class="operator">.</span>open(<span class="type"><a href="qiodevice.html">QIODevice</a></span><span class="operator">::</span>ReadOnly);

     <span class="type"><a href="qxmlschemavalidator.html">QXmlSchemaValidator</a></span> validator(schema);
     <span class="keyword">if</span> (validator<span class="operator">.</span>validate(<span class="operator">&amp;</span>buffer))
         <a href="qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;instance document is valid&quot;</span>;
     <span class="keyword">else</span>
         <a href="qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;instance document is invalid&quot;</span>;</pre>
<!-- @@@validate -->
</div>
  <div class="ft">
    <span></span>
  </div>
</div> 
<div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2012 Nokia Corporation and/or its
      subsidiaries. Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      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.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Nokia, Qt and their respective logos are trademarks of Nokia Corporation 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>