This file is indexed.

/usr/share/qt5/doc/qtxmlpatterns/qxmlquery.html is in qtxmlpatterns5-doc-html 5.3.2-2.

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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.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" />
<!-- qxmlquery.cpp -->
  <title>QXmlQuery Class | QtXmlPatterns </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.3</li>
<li><a href="qtxmlpatterns-index.html">Qt XML Patterns</a></li>
<li><a href="qtxmlpatterns-module.html">C++ Classes</a></li>
<li>QXmlQuery</li>
<li id="buildversion">
Qt 5.3.2 Reference Documentation</li>
    </ul>
    </div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<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="#running-xqueries">Running XQueries</a></li>
<li class="level2"><a href="#running-xpath-expressions">Running XPath Expressions</a></li>
<li class="level2"><a href="#running-xslt-stylesheets">Running XSLT stylesheets</a></li>
<li class="level2"><a href="#binding-a-query-to-a-starting-node">Binding A Query To A Starting Node</a></li>
<li class="level2"><a href="#reentrancy-and-thread-safety">Reentrancy and Thread-Safety</a></li>
<li class="level2"><a href="#error-handling">Error Handling</a></li>
<li class="level2"><a href="#resource-management">Resource Management</a></li>
<li class="level2"><a href="#event-handling">Event Handling</a></li>
</ul>
</div>
<h1 class="title">QXmlQuery Class</h1>
<!-- $$$QXmlQuery-brief -->
<p>The QXmlQuery class performs XQueries on XML data, or on non-XML data modeled to look like XML. <a href="#details">More...</a></p>
<!-- @@@QXmlQuery -->
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> </b><tt><span class="preprocessor">#include &lt;QXmlQuery&gt;</span>
</tt></td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> <tt>QT += xmlpatterns</tt></td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign">  Qt 4.4</td></tr></table><p><b>Note:</b> All functions in this class are reentrant.</p>
<ul>
<li><a href="qxmlquery-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#QueryLanguage-enum">QueryLanguage</a></b> { XQuery10, XSLT20 }</td></tr>
</table>
<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="qxmlquery.html#QXmlQuery">QXmlQuery</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#QXmlQuery-2">QXmlQuery</a></b>(const QXmlQuery &amp;<i> other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#QXmlQuery-3">QXmlQuery</a></b>(const QXmlNamePool &amp;<i> np</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#QXmlQuery-4">QXmlQuery</a></b>(QueryLanguage<i> queryLanguage</i>, const QXmlNamePool &amp;<i> np</i> = QXmlNamePool())</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#dtor.QXmlQuery">~QXmlQuery</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#bindVariable">bindVariable</a></b>(const QXmlName &amp;<i> name</i>, const QXmlItem &amp;<i> value</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#bindVariable-2">bindVariable</a></b>(const QXmlName &amp;<i> name</i>, QIODevice *<i> device</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#bindVariable-3">bindVariable</a></b>(const QXmlName &amp;<i> name</i>, const QXmlQuery &amp;<i> query</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#bindVariable-4">bindVariable</a></b>(const QString &amp;<i> localName</i>, const QXmlItem &amp;<i> value</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#bindVariable-5">bindVariable</a></b>(const QString &amp;<i> localName</i>, QIODevice *<i> device</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#bindVariable-6">bindVariable</a></b>(const QString &amp;<i> localName</i>, const QXmlQuery &amp;<i> query</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#evaluateTo">evaluateTo</a></b>(QXmlResultItems *<i> result</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#evaluateTo-2">evaluateTo</a></b>(QAbstractXmlReceiver *<i> callback</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#evaluateTo-3">evaluateTo</a></b>(QStringList *<i> target</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#evaluateTo-4">evaluateTo</a></b>(QString *<i> output</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#evaluateTo-5">evaluateTo</a></b>(QIODevice *<i> target</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QXmlName </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#initialTemplateName">initialTemplateName</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#isValid">isValid</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAbstractMessageHandler * </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#messageHandler">messageHandler</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QXmlNamePool </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#namePool">namePool</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QNetworkAccessManager * </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#networkAccessManager">networkAccessManager</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QueryLanguage </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#queryLanguage">queryLanguage</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#setFocus">setFocus</a></b>(const QXmlItem &amp;<i> item</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#setFocus-2">setFocus</a></b>(const QUrl &amp;<i> documentURI</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#setFocus-3">setFocus</a></b>(QIODevice *<i> document</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#setFocus-4">setFocus</a></b>(const QString &amp;<i> focus</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#setInitialTemplateName">setInitialTemplateName</a></b>(const QXmlName &amp;<i> name</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#setInitialTemplateName-2">setInitialTemplateName</a></b>(const QString &amp;<i> localName</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#setMessageHandler">setMessageHandler</a></b>(QAbstractMessageHandler *<i> aMessageHandler</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#setNetworkAccessManager">setNetworkAccessManager</a></b>(QNetworkAccessManager *<i> newManager</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#setQuery">setQuery</a></b>(QIODevice *<i> sourceCode</i>, const QUrl &amp;<i> documentURI</i> = QUrl())</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#setQuery-2">setQuery</a></b>(const QUrl &amp;<i> queryURI</i>, const QUrl &amp;<i> baseURI</i> = QUrl())</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#setQuery-3">setQuery</a></b>(const QString &amp;<i> sourceCode</i>, const QUrl &amp;<i> documentURI</i> = QUrl())</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.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="qxmlquery.html#uriResolver">uriResolver</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QXmlQuery &amp; </td><td class="memItemRight bottomAlign"><b><a href="qxmlquery.html#operator-eq">operator=</a></b>(const QXmlQuery &amp;<i> other</i>)</td></tr>
</table>
<a name="details"></a>
<!-- $$$QXmlQuery-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QXmlQuery class performs XQueries on XML data, or on non-XML data modeled to look like XML.</p>
<p>The QXmlQuery class compiles and executes queries written in the <a href="http://www.w3.org/TR/xquery/">XQuery language</a>. QXmlQuery is typically used to query XML data, but it can also query non-XML data that has been modeled to look like XML.</p>
<p>Using QXmlQuery to query XML data, as in the snippet below, is simple because it can use the built-in <a href="qabstractxmlnodemodel.html">XML data model</a> as its delegate to the underlying query engine for traversing the data. The built-in data model is specified in <a href="http://www.w3.org/TR/xpath-datamodel/">XQuery 1.0 and XPath 2.0 Data Model</a>.</p>
<pre class="cpp"><span class="type">QXmlQuery</span> query;
query<span class="operator">.</span><a href="qxmlquery.html#setQuery">setQuery</a>(<span class="string">&quot;doc('index.html')/html/body/p[1]&quot;</span>);

<span class="type"><a href="qxmlserializer.html">QXmlSerializer</a></span> serializer(query<span class="operator">,</span> myOutputDevice);
query<span class="operator">.</span><a href="qxmlquery.html#evaluateTo">evaluateTo</a>(<span class="operator">&amp;</span>serializer);</pre>
<p>The example uses QXmlQuery to match the first paragraph of an XML document and then <a href="qxmlserializer.html">output the result</a> to a device as XML.</p>
<p>Using QXmlQuery to query <i>non-XML</i> data requires writing a subclass of <a href="qabstractxmlnodemodel.html">QAbstractXmlNodeModel</a> to use as a replacement for the built-in XML data model. The custom data model will be able to traverse the non-XML data as required by the <a href="qabstractxmlnodemodel.html">QAbstractXmlNodeModel</a> interface. An instance of this custom data model then becomes the delegate used by the query engine to traverse the non-XML data. For an example of how to use QXmlQuery to query non-XML data, see the documentation for <a href="qabstractxmlnodemodel.html">QAbstractXmlNodeModel</a>.</p>
<a name="running-xqueries"></a>
<h3>Running XQueries</h3>
<p>To run a query set up with QXmlQuery, call one of the evaluation functions.</p>
<ul>
<li>evaluateTo(<a href="qabstractxmlreceiver.html">QAbstractXmlReceiver</a> *) is called with a pointer to an XML <a href="qabstractxmlreceiver.html">receiver</a>, which receives the query results as a sequence of callbacks. The receiver callback class is like the callback class used for translating the output of a SAX parser. <a href="qxmlserializer.html">QXmlSerializer</a>, for example, is a receiver callback class for translating the sequence of callbacks for output as unformatted XML text.</li>
</ul>
<ul>
<li>evaluateTo(<a href="qxmlresultitems.html">QXmlResultItems</a> *) is called with a pointer to an iterator for an empty sequence of query <a href="qxmlresultitems.html">result items</a>. The Java-like iterator allows the query results to be accessed sequentially.</li>
</ul>
<ul>
<li>evaluateTo(QStringList *) is like evaluateTo(<a href="qxmlresultitems.html">QXmlResultItems</a> *), but the query must evaluate to a sequence of strings.</li>
</ul>
<a name="running-xpath-expressions"></a>
<h3>Running XPath Expressions</h3>
<p>The XPath language is a subset of the <a href="xmlprocessing.html">XQuery</a> language, so running an XPath expression is the same as running an <a href="xmlprocessing.html">XQuery</a> query. Pass the XPath expression to QXmlQuery using <a href="qxmlquery.html#setQuery">setQuery</a>().</p>
<a name="running-xslt-stylesheets"></a>
<h3>Running XSLT stylesheets</h3>
<p>Running an XSLT stylesheet is like running an <a href="xmlprocessing.html">XQuery</a>, except that when you construct your QXmlQuery, you must pass <a href="qxmlquery.html#QueryLanguage-enum">QXmlQuery::XSLT20</a> to tell QXmlQuery to interpret whatever it gets from <a href="qxmlquery.html#setQuery">setQuery</a>() as an XSLT stylesheet instead of as an <a href="xmlprocessing.html">XQuery</a>. You must also set the input document by calling <a href="qxmlquery.html#setFocus">setFocus</a>().</p>
<pre class="cpp">    <span class="type">QXmlQuery</span> query(<span class="type">QXmlQuery</span><span class="operator">::</span>XSLT20);
    query<span class="operator">.</span>setFocus(<span class="type">QUrl</span>(<span class="string">&quot;myInput.xml&quot;</span>));
    query<span class="operator">.</span>setQuery(<span class="type">QUrl</span>(<span class="string">&quot;myStylesheet.xsl&quot;</span>));
    query<span class="operator">.</span>evaluateTo(out);</pre>
<p><b>Note: </b>Currently, <a href="qxmlquery.html#setFocus">setFocus</a>() must be called <i>before</i> <a href="qxmlquery.html#setQuery">setQuery</a>() when using XSLT.</p><p>Another way to run an XSLT stylesheet is to use the <tt>xmlpatterns</tt> command line utility.</p>
<pre class="cpp">xmlpatterns myStylesheet<span class="operator">.</span>xsl myInput<span class="operator">.</span>xml</pre>
<p><b>Note: </b>For the current release, XSLT support should be considered experimental. See section <a href="xmlprocessing.html#xslt-2-0">XSLT conformance</a> for details.</p><p>Stylesheet parameters are bound using <a href="qxmlquery.html#bindVariable">bindVariable</a>().</p>
<a name="binding-a-query-to-a-starting-node"></a>
<h3>Binding A Query To A Starting Node</h3>
<p>When a query is run on XML data, as in the snippet above, the <tt>doc()</tt> function returns the node in the built-in data model where the query evaluation will begin. But when a query is run on a custom node model containing non-XML data, one of the <a href="qxmlquery.html#bindVariable">bindVariable</a>() functions must be called to bind a variable name to a starting node in the custom model. A $variable reference is used in the <a href="xmlprocessing.html">XQuery</a> text to access the starting node in the custom model. It is not necessary to declare the variable name external in the query. See the example in the documentation for <a href="qabstractxmlnodemodel.html">QAbstractXmlNodeModel</a>.</p>
<a name="reentrancy-and-thread-safety"></a>
<h3>Reentrancy and Thread-Safety</h3>
<p>QXmlQuery is reentrant but not thread-safe. It is safe to use the QxmlQuery copy constructor to create a copy of a query and run the same query multiple times. Behind the scenes, QXmlQuery will reuse resources such as opened files and compiled queries to the extent possible. But it is not safe to use the same instance of QXmlQuery in multiple threads.</p>
<a name="error-handling"></a>
<h3>Error Handling</h3>
<p>Errors can occur during query evaluation. Examples include type errors and file loading errors. When an error occurs:</p>
<ul>
<li>The error message is sent to the <a href="qxmlquery.html#messageHandler">messageHandler</a>().</li>
<li><a href="qxmlresultitems.html#hasError">QXmlResultItems::hasError</a>() will return <tt>true</tt>, or <a href="qxmlquery.html#evaluateTo">evaluateTo</a>() will return <tt>false</tt>;</li>
<li>The results of the evaluation are undefined.</li>
</ul>
<a name="resource-management"></a>
<h3>Resource Management</h3>
<p>When a query runs, it parses documents, allocating internal data structures to hold them, and it may load other resources over the network. It reuses these allocated resources when possible, to avoid having to reload and reparse them.</p>
<p>When <a href="qxmlquery.html#setQuery">setQuery</a>() is called, the query text is compiled into an internal data structure and optimized. The optimized form can then be reused for multiple evaluations of the query. Since the compile-and-optimize process can be expensive, repeating it for the same query should be avoided by using a separate instance of QXmlQuery for each query text.</p>
<p>Once a document has been parsed, its internal representation is maintained in the QXmlQuery instance and shared among multiple QXmlQuery instances.</p>
<p>An instance of QCoreApplication must exist before QXmlQuery can be used.</p>
<a name="event-handling"></a>
<h3>Event Handling</h3>
<p>When QXmlQuery accesses resources (e.g&#x2e;, calling <tt>fn:doc()</tt> to load a file, or accessing a device via a bound variable), the event loop is used, which means events will be processed. To avoid processing events when QXmlQuery accesses resources, create your QXmlQuery instance in a separate thread.</p>
</div>
<!-- @@@QXmlQuery -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$QueryLanguage$$$XQuery10$$$XSLT20$$$XmlSchema11IdentityConstraintSelector$$$XmlSchema11IdentityConstraintField$$$XPath20 -->
<h3 class="fn"><a name="QueryLanguage-enum"></a>enum QXmlQuery::<span class="name">QueryLanguage</span></h3>
<p>Specifies whether you want <a href="qxmlquery.html">QXmlQuery</a> to interpret the input to <a href="qxmlquery.html#setQuery">setQuery</a>() as an <a href="xmlprocessing.html">XQuery</a> or as an XSLT stylesheet.</p>
<table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><tt>QXmlQuery::XQuery10</tt></td><td class="topAlign"><tt>1</tt></td><td class="topAlign"><a href="xmlprocessing.html">XQuery</a> 1.0&#x2e;</td></tr>
<tr><td class="topAlign"><tt>QXmlQuery::XSLT20</tt></td><td class="topAlign"><tt>2</tt></td><td class="topAlign">XSLT 2.0 The selector, the restricted XPath pattern found in W3C XML Schema 1.1 for uniqueness contraints. Apart from restricting the syntax, the type check stage for the expression assumes a sequence of nodes to be the focus. The field, the restricted XPath pattern found in W3C XML Schema 1.1 for uniqueness contraints. Apart from restricting the syntax, the type check stage for the expression assumes a sequence of nodes to be the focus. Signifies XPath 2.0&#x2e; Has no effect in the public API, it's used internally. As With XmlSchema11IdentityConstraintSelector and XmlSchema11IdentityConstraintField, the type check stage for the expression assumes a sequence of nodes to be the focus.</td></tr>
</table>
<p>This enum was introduced or modified in  Qt 4.5.</p>
<p><b>See also </b><a href="qxmlquery.html#setQuery">setQuery</a>().</p>
<!-- @@@QueryLanguage -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QXmlQuery[overload1]$$$QXmlQuery -->
<h3 class="fn"><a name="QXmlQuery"></a>QXmlQuery::<span class="name">QXmlQuery</span>()</h3>
<p>Constructs an invalid, empty query that cannot be used until <a href="qxmlquery.html#setQuery">setQuery</a>() is called.</p>
<p><b>Note: </b>This constructor must not be used if you intend to use this <a href="qxmlquery.html">QXmlQuery</a> to process XSL-T stylesheets. The other constructor must be used in that case.</p><!-- @@@QXmlQuery -->
<!-- $$$QXmlQuery$$$QXmlQueryconstQXmlQuery& -->
<h3 class="fn"><a name="QXmlQuery-2"></a>QXmlQuery::<span class="name">QXmlQuery</span>(const <span class="type">QXmlQuery</span> &amp;<i> other</i>)</h3>
<p>Constructs a <a href="qxmlquery.html">QXmlQuery</a> that is a copy of <i>other</i>. The new instance will share resources with the existing query to the extent possible.</p>
<!-- @@@QXmlQuery -->
<!-- $$$QXmlQuery$$$QXmlQueryconstQXmlNamePool& -->
<h3 class="fn"><a name="QXmlQuery-3"></a>QXmlQuery::<span class="name">QXmlQuery</span>(const <span class="type"><a href="qxmlnamepool.html">QXmlNamePool</a></span> &amp;<i> np</i>)</h3>
<p>Constructs a query that will use <i>np</i> as its name pool. The query cannot be evaluated until <a href="qxmlquery.html#setQuery">setQuery</a>() has been called.</p>
<!-- @@@QXmlQuery -->
<!-- $$$QXmlQuery$$$QXmlQueryQueryLanguageconstQXmlNamePool& -->
<h3 class="fn"><a name="QXmlQuery-4"></a>QXmlQuery::<span class="name">QXmlQuery</span>(<span class="type"><a href="qxmlquery.html#QueryLanguage-enum">QueryLanguage</a></span><i> queryLanguage</i>, const <span class="type"><a href="qxmlnamepool.html">QXmlNamePool</a></span> &amp;<i> np</i> = QXmlNamePool())</h3>
<p>Constructs a query that will be used to run Xqueries or XSL-T stylesheets, depending on the value of <i>queryLanguage</i>. It will use <i>np</i> as its name pool.</p>
<p><b>Note: </b>If your <a href="qxmlquery.html">QXmlQuery</a> will process XSL-T stylesheets, this constructor must be used. The default constructor can only create instances of <a href="qxmlquery.html">QXmlQuery</a> for running XQueries.</p><p><b>Note: </b>The XSL-T support in this release is considered experimental. See the <a href="xmlprocessing.html#xslt-2-0">XSLT conformance</a> for details.</p><p>This function was introduced in  Qt 4.5.</p>
<p><b>See also </b><a href="qxmlquery.html#queryLanguage">queryLanguage</a>().</p>
<!-- @@@QXmlQuery -->
<!-- $$$~QXmlQuery[overload1]$$$~QXmlQuery -->
<h3 class="fn"><a name="dtor.QXmlQuery"></a>QXmlQuery::<span class="name">~QXmlQuery</span>()</h3>
<p>Destroys this <a href="qxmlquery.html">QXmlQuery</a>.</p>
<!-- @@@~QXmlQuery -->
<!-- $$$bindVariable[overload1]$$$bindVariableconstQXmlName&constQXmlItem& -->
<h3 class="fn"><a name="bindVariable"></a><span class="type">void</span> QXmlQuery::<span class="name">bindVariable</span>(const <span class="type"><a href="qxmlname.html">QXmlName</a></span> &amp;<i> name</i>, const <span class="type"><a href="qxmlitem.html">QXmlItem</a></span> &amp;<i> value</i>)</h3>
<p>Binds the variable <i>name</i> to the <i>value</i> so that $<i>name</i> can be used from within the query to refer to the <i>value</i>.</p>
<p><i>name</i> must not be <i>null</i>. <i>name</i>.isNull() must return false. If <i>name</i> has already been bound by a previous bindVariable() call, its previous binding will be overridden.</p>
<p>If <i>value</i> is null so that <i>value</i>.isNull() returns true, and <i>name</i> already has a binding, the effect is to remove the existing binding for <i>name</i>.</p>
<p>To bind a value of type QString or QUrl, wrap the value in a QVariant such that <a href="qxmlitem.html">QXmlItem</a>'s QVariant constructor is called.</p>
<p>All strings processed by the query must be valid <a href="xmlprocessing.html">XQuery</a> strings, which means they must contain only XML 1.0 characters. However, this requirement is not checked. If the query processes an invalid string, the behavior is undefined.</p>
<p><b>See also </b>QVariant::isValid(), <a href="xmlprocessing.html#qtxdm">How QVariant maps to XQuery's Data Model</a>, and <a href="qxmlitem.html#isNull">QXmlItem::isNull</a>().</p>
<!-- @@@bindVariable -->
<!-- $$$bindVariable$$$bindVariableconstQXmlName&QIODevice* -->
<h3 class="fn"><a name="bindVariable-2"></a><span class="type">void</span> QXmlQuery::<span class="name">bindVariable</span>(const <span class="type"><a href="qxmlname.html">QXmlName</a></span> &amp;<i> name</i>, <span class="type">QIODevice</span> *<i> device</i>)</h3>
<p>Binds the variable <i>name</i> to the <i>device</i> so that $<i>name</i> can be used from within the query to refer to the <i>device</i>. The QIODevice <i>device</i> is exposed to the query as a URI of type <tt>xs:anyURI</tt>, which can be passed to the <tt>fn:doc()</tt> function to be read. E.g&#x2e;, this function can be used to pass an XML document in memory to <tt>fn:doc</tt>.</p>
<pre class="cpp">    <span class="type">QByteArray</span> myDocument;
    <span class="type">QBuffer</span> buffer(<span class="operator">&amp;</span>myDocument); <span class="comment">// This is a QIODevice.</span>
    buffer<span class="operator">.</span>open(<span class="type">QIODevice</span><span class="operator">::</span>ReadOnly);
    <span class="type"><a href="qxmlquery.html">QXmlQuery</a></span> query;
    query<span class="operator">.</span>bindVariable(<span class="string">&quot;myDocument&quot;</span><span class="operator">,</span> <span class="operator">&amp;</span>buffer);
    query<span class="operator">.</span>setQuery(<span class="string">&quot;doc($myDocument)&quot;</span>);</pre>
<p>The caller must ensure that <i>device</i> has been opened with at least QIODevice::ReadOnly prior to this binding. Otherwise, behavior is undefined.</p>
<p>If the query will access an XML document contained in a QString, use a QBuffer as shown in the following snippet. Suppose <i>myQString</i> contains <tt>&lt;document&gt;content&lt;/document&gt;</tt></p>
<pre class="cpp">    <span class="type">QBuffer</span> device;
    device<span class="operator">.</span>setData(myQString<span class="operator">.</span>toUtf8());
    device<span class="operator">.</span>open(<span class="type">QIODevice</span><span class="operator">::</span>ReadOnly);

    <span class="type"><a href="qxmlquery.html">QXmlQuery</a></span> query;
    query<span class="operator">.</span><a href="qxmlquery.html#setQuery">setQuery</a>(<span class="string">&quot;doc($inputDocument)/query[theDocument]&quot;</span>);
    query<span class="operator">.</span><a href="qxmlquery.html#bindVariable">bindVariable</a>(<span class="string">&quot;inputDocument&quot;</span><span class="operator">,</span> <span class="operator">&amp;</span>device);</pre>
<p><i>name</i> must not be <i>null</i>. <i>name</i>.isNull() must return false. If <i>name</i> has already been bound, its previous binding will be overridden. The URI that <i>name</i> evaluates to is arbitrary and may change.</p>
<p>If the type of the variable binding changes (e.g&#x2e;, if a previous binding by the same name was a QVariant, or if there was no previous binding), <a href="qxmlquery.html#isValid">isValid</a>() will return <tt>false</tt>, and recompilation of the query text is required. To recompile the query, call <a href="qxmlquery.html#setQuery">setQuery</a>(). For this reason, <a href="qxmlquery.html#bindVariable">bindVariable</a>() should be called before <a href="qxmlquery.html#setQuery">setQuery</a>(), if possible.</p>
<p><b>Note: </b><i>device</i> must not be deleted while this <a href="qxmlquery.html">QXmlQuery</a> exists.</p><!-- @@@bindVariable -->
<!-- $$$bindVariable$$$bindVariableconstQXmlName&constQXmlQuery& -->
<h3 class="fn"><a name="bindVariable-3"></a><span class="type">void</span> QXmlQuery::<span class="name">bindVariable</span>(const <span class="type"><a href="qxmlname.html">QXmlName</a></span> &amp;<i> name</i>, const <span class="type">QXmlQuery</span> &amp;<i> query</i>)</h3>
<p>Binds the result of the query <i>query</i>, to a variable by name <i>name</i>.</p>
<p>Evaluation of <i>query</i> will be commenced when this function is called.</p>
<p>If <i>query</i> is invalid, behavior is undefined. <i>query</i> will be copied.</p>
<p>This function was introduced in  Qt 4.5.</p>
<p><b>See also </b><a href="qxmlquery.html#isValid">isValid</a>().</p>
<!-- @@@bindVariable -->
<!-- $$$bindVariable$$$bindVariableconstQString&constQXmlItem& -->
<h3 class="fn"><a name="bindVariable-4"></a><span class="type">void</span> QXmlQuery::<span class="name">bindVariable</span>(const <span class="type">QString</span> &amp;<i> localName</i>, const <span class="type"><a href="qxmlitem.html">QXmlItem</a></span> &amp;<i> value</i>)</h3>
<p>This is an overloaded function.</p>
<p>This function constructs a <a href="qxmlname.html">QXmlName</a> from <i>localName</i> using the query's <a href="qxmlnamepool.html">namespace</a>. The function then behaves as the overloaded function. It is equivalent to the following snippet.</p>
<pre class="cpp">    <span class="type"><a href="qxmlnamepool.html">QXmlNamePool</a></span> <a href="qxmlquery.html#namePool">namePool</a>(query<span class="operator">.</span>namePool());
    query<span class="operator">.</span><a href="qxmlquery.html#bindVariable">bindVariable</a>(<span class="type"><a href="qxmlname.html">QXmlName</a></span>(namePool<span class="operator">,</span> localName)<span class="operator">,</span> value);</pre>
<!-- @@@bindVariable -->
<!-- $$$bindVariable$$$bindVariableconstQString&QIODevice* -->
<h3 class="fn"><a name="bindVariable-5"></a><span class="type">void</span> QXmlQuery::<span class="name">bindVariable</span>(const <span class="type">QString</span> &amp;<i> localName</i>, <span class="type">QIODevice</span> *<i> device</i>)</h3>
<p>This is an overloaded function.</p>
<p>If <i>localName</i> is a valid <a href="qxmlname.html#isNCName">NCName</a>, this function is equivalent to the following snippet.</p>
<pre class="cpp">    <span class="type"><a href="qxmlnamepool.html">QXmlNamePool</a></span> namePool(query<span class="operator">.</span>namePool());
    query<span class="operator">.</span>bindVariable(<span class="type"><a href="qxmlname.html">QXmlName</a></span>(namePool<span class="operator">,</span> localName)<span class="operator">,</span> device);</pre>
<p>A <a href="qxmlname.html">QXmlName</a> is constructed from <i>localName</i>, and is passed to the appropriate overload along with <i>device</i>.</p>
<p><b>See also </b><a href="qxmlname.html#isNCName">QXmlName::isNCName</a>().</p>
<!-- @@@bindVariable -->
<!-- $$$bindVariable$$$bindVariableconstQString&constQXmlQuery& -->
<h3 class="fn"><a name="bindVariable-6"></a><span class="type">void</span> QXmlQuery::<span class="name">bindVariable</span>(const <span class="type">QString</span> &amp;<i> localName</i>, const <span class="type">QXmlQuery</span> &amp;<i> query</i>)</h3>
<p>This is an overloaded function.</p>
<p>Has the same behavior and effects as the function being overloaded, but takes the variable name <i>localName</i> as a QString. <i>query</i> is used as in the overloaded function.</p>
<p>This function was introduced in  Qt 4.5.</p>
<!-- @@@bindVariable -->
<!-- $$$evaluateTo[overload1]$$$evaluateToQXmlResultItems* -->
<h3 class="fn"><a name="evaluateTo"></a><span class="type">void</span> QXmlQuery::<span class="name">evaluateTo</span>(<span class="type"><a href="qxmlresultitems.html">QXmlResultItems</a></span> *<i> result</i>) const</h3>
<p>Starts the evaluation and makes it available in <i>result</i>. If <i>result</i> is null, the behavior is undefined. The evaluation takes place incrementally (lazy evaluation), as the caller uses <a href="qxmlresultitems.html#next">QXmlResultItems::next</a>() to get the next result.</p>
<p><b>See also </b><a href="qxmlresultitems.html#next">QXmlResultItems::next</a>().</p>
<!-- @@@evaluateTo -->
<!-- $$$evaluateTo$$$evaluateToQAbstractXmlReceiver* -->
<h3 class="fn"><a name="evaluateTo-2"></a><span class="type">bool</span> QXmlQuery::<span class="name">evaluateTo</span>(<span class="type"><a href="qabstractxmlreceiver.html">QAbstractXmlReceiver</a></span> *<i> callback</i>) const</h3>
<p>Evaluates this query and sends the result as a sequence of callbacks to the <a href="qabstractxmlreceiver.html">receiver</a> <i>callback</i>. <a href="qxmlquery.html">QXmlQuery</a> does not take ownership of <i>callback</i>.</p>
<p>If an error occurs during the evaluation, error messages are sent to <a href="qxmlquery.html#messageHandler">messageHandler</a>() and <tt>false</tt> is returned.</p>
<p>If this query <a href="qxmlquery.html#isValid">is invalid</a>, <tt>false</tt> is returned and the behavior is undefined. If <i>callback</i> is null, behavior is undefined.</p>
<p><b>See also </b><a href="qabstractxmlreceiver.html">QAbstractXmlReceiver</a> and <a href="qxmlquery.html#isValid">isValid</a>().</p>
<!-- @@@evaluateTo -->
<!-- $$$evaluateTo$$$evaluateToQStringList* -->
<h3 class="fn"><a name="evaluateTo-3"></a><span class="type">bool</span> QXmlQuery::<span class="name">evaluateTo</span>(<span class="type">QStringList</span> *<i> target</i>) const</h3>
<p>Attempts to evaluate the query and returns the results in the <i>target</i> string list.</p>
<p>If the query <a href="qxmlquery.html#isValid">is valid</a> and the evaluation succeeds, true is returned. Otherwise, false is returned and the contents of <i>target</i> are undefined.</p>
<p>The query must evaluate to a sequence of <tt>xs:string</tt> values. If the query does not evaluate to a sequence of strings, the values can often be converted by adding a call to <tt>string()</tt> at the end of the <a href="xmlprocessing.html">XQuery</a>.</p>
<p>If <i>target</i> is null, the behavior is undefined.</p>
<!-- @@@evaluateTo -->
<!-- $$$evaluateTo$$$evaluateToQString* -->
<h3 class="fn"><a name="evaluateTo-4"></a><span class="type">bool</span> QXmlQuery::<span class="name">evaluateTo</span>(<span class="type">QString</span> *<i> output</i>) const</h3>
<p>Evaluates the query, and serializes the output as XML to <i>output</i>.</p>
<p>If an error occurs during the evaluation, error messages are sent to <a href="qxmlquery.html#messageHandler">messageHandler</a>(), the content of <i>output</i> is undefined and <tt>false</tt> is returned, otherwise <tt>true</tt> is returned.</p>
<p>If <i>output</i> is <tt>null</tt> behavior is undefined. <a href="qxmlquery.html">QXmlQuery</a> does not take ownership of <i>output</i>.</p>
<p>Internally, the class <a href="qxmlformatter.html">QXmlFormatter</a> is used for this.</p>
<p>This function was introduced in  Qt 4.5.</p>
<!-- @@@evaluateTo -->
<!-- $$$evaluateTo$$$evaluateToQIODevice* -->
<h3 class="fn"><a name="evaluateTo-5"></a><span class="type">bool</span> QXmlQuery::<span class="name">evaluateTo</span>(<span class="type">QIODevice</span> *<i> target</i>) const</h3>
<p>Evaluates the query or stylesheet, and writes the output to <i>target</i>.</p>
<p><a href="qxmlserializer.html">QXmlSerializer</a> is used to write the output to <i>target</i>. In a future release, it is expected that this function will be changed to respect serialization options set in the stylesheet.</p>
<p>If an error occurs during the evaluation, error messages are sent to <a href="qxmlquery.html#messageHandler">messageHandler</a>() and <tt>false</tt> is returned.</p>
<p>If <i>target</i> is <tt>null</tt>, or is not opened in at least QIODevice::WriteOnly mode, the behavior is undefined. <a href="qxmlquery.html">QXmlQuery</a> does not take ownership of <i>target</i>.</p>
<p>This is an overloaded function.</p>
<p>This function was introduced in  Qt 4.5.</p>
<!-- @@@evaluateTo -->
<!-- $$$initialTemplateName[overload1]$$$initialTemplateName -->
<h3 class="fn"><a name="initialTemplateName"></a><span class="type"><a href="qxmlname.html">QXmlName</a></span> QXmlQuery::<span class="name">initialTemplateName</span>() const</h3>
<p>Returns the name of the XSL-T stylesheet template that the processor will call first when running an XSL-T stylesheet. This function only applies when using <a href="qxmlquery.html">QXmlQuery</a> to process XSL-T stylesheets. By default, no initial template is set. In that case, a default constructed <a href="qxmlname.html">QXmlName</a> is returned.</p>
<p>This function was introduced in  Qt 4.5.</p>
<p><b>See also </b><a href="qxmlquery.html#setInitialTemplateName">setInitialTemplateName</a>().</p>
<!-- @@@initialTemplateName -->
<!-- $$$isValid[overload1]$$$isValid -->
<h3 class="fn"><a name="isValid"></a><span class="type">bool</span> QXmlQuery::<span class="name">isValid</span>() const</h3>
<p>Returns true if this query is valid. Examples of invalid queries are ones that contain syntax errors or that have not had <a href="qxmlquery.html#setQuery">setQuery</a>() called for them yet.</p>
<!-- @@@isValid -->
<!-- $$$messageHandler[overload1]$$$messageHandler -->
<h3 class="fn"><a name="messageHandler"></a><span class="type"><a href="qabstractmessagehandler.html">QAbstractMessageHandler</a></span> * QXmlQuery::<span class="name">messageHandler</span>() const</h3>
<p>Returns the message handler that handles compile and runtime messages for this <a href="qxmlquery.html">QXmlQuery</a>.</p>
<p><b>See also </b><a href="qxmlquery.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> QXmlQuery::<span class="name">namePool</span>() const</h3>
<p>Returns the name pool used by this <a href="qxmlquery.html">QXmlQuery</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">QNetworkAccessManager</span> * QXmlQuery::<span class="name">networkAccessManager</span>() const</h3>
<p>Returns the network manager, or 0 if it has not been set.</p>
<p>This function was introduced in  Qt 4.5.</p>
<p><b>See also </b><a href="qxmlquery.html#setNetworkAccessManager">setNetworkAccessManager</a>().</p>
<!-- @@@networkAccessManager -->
<!-- $$$queryLanguage[overload1]$$$queryLanguage -->
<h3 class="fn"><a name="queryLanguage"></a><span class="type"><a href="qxmlquery.html#QueryLanguage-enum">QueryLanguage</a></span> QXmlQuery::<span class="name">queryLanguage</span>() const</h3>
<p>Returns a value indicating what this <a href="qxmlquery.html">QXmlQuery</a> is being used for. The default is <a href="qxmlquery.html#QueryLanguage-enum">QXmlQuery::XQuery10</a>, which means the <a href="qxmlquery.html">QXmlQuery</a> is being used for running <a href="xmlprocessing.html">XQuery</a> and XPath queries. <a href="qxmlquery.html#QueryLanguage-enum">QXmlQuery::XSLT20</a> can also be returned, which indicates the <a href="qxmlquery.html">QXmlQuery</a> is for running XSL-T spreadsheets.</p>
<p>This function was introduced in  Qt 4.5.</p>
<!-- @@@queryLanguage -->
<!-- $$$setFocus[overload1]$$$setFocusconstQXmlItem& -->
<h3 class="fn"><a name="setFocus"></a><span class="type">void</span> QXmlQuery::<span class="name">setFocus</span>(const <span class="type"><a href="qxmlitem.html">QXmlItem</a></span> &amp;<i> item</i>)</h3>
<p>Sets the focus to <i>item</i>. The focus is the set of items that the context item expression and path expressions navigate from. For example, in the expression <i>p/span</i>, the element that <i>p</i> evaluates to is the focus for the following expression, <i>span</i>.</p>
<p>The focus can be accessed using the context item expression, i.e&#x2e;, dot (&quot;.&quot;).</p>
<p>By default, the focus is not set and is undefined. It will therefore result in a dynamic error, <tt>XPDY0002</tt>, if the focus is attempted to be accessed. The focus must be set before the query is set with <a href="qxmlquery.html#setQuery">setQuery</a>().</p>
<p>There is no behavior defined for setting an item which is null.</p>
<!-- @@@setFocus -->
<!-- $$$setFocus$$$setFocusconstQUrl& -->
<h3 class="fn"><a name="setFocus-2"></a><span class="type">bool</span> QXmlQuery::<span class="name">setFocus</span>(const <span class="type">QUrl</span> &amp;<i> documentURI</i>)</h3>
<p>This is an overloaded function.</p>
<p>Sets the focus to be the document located at <i>documentURI</i> and returns true. If <i>documentURI</i> cannot be loaded, false is returned. It is undefined at what time the document may be loaded. When loading the document, the message handler and URI resolver set on this <a href="qxmlquery.html">QXmlQuery</a> are used.</p>
<p>If <i>documentURI</i> is empty or is not a valid URI, the behavior of this function is undefined.</p>
<p>This function was introduced in  Qt 4.5.</p>
<!-- @@@setFocus -->
<!-- $$$setFocus$$$setFocusQIODevice* -->
<h3 class="fn"><a name="setFocus-3"></a><span class="type">bool</span> QXmlQuery::<span class="name">setFocus</span>(<span class="type">QIODevice</span> *<i> document</i>)</h3>
<p>Sets the focus to be the <i>document</i> read from the QIODevice and returns true. If <i>document</i> cannot be loaded, false is returned.</p>
<p><a href="qxmlquery.html">QXmlQuery</a> does not take ownership of <i>document</i>. The user guarantees that a document is available from the <i>document</i> device and that the document is not empty. The device must be opened in at least read-only mode. <i>document</i> must stay in scope as long as the current query is active.</p>
<p>This is an overloaded function.</p>
<p>This function was introduced in  Qt 4.5.</p>
<!-- @@@setFocus -->
<!-- $$$setFocus$$$setFocusconstQString& -->
<h3 class="fn"><a name="setFocus-4"></a><span class="type">bool</span> QXmlQuery::<span class="name">setFocus</span>(const <span class="type">QString</span> &amp;<i> focus</i>)</h3>
<p>This function behaves identically to calling the <a href="qxmlquery.html#setFocus">setFocus</a>() overload with a QIODevice whose content is <i>focus</i> encoded as UTF-8. That is, <i>focus</i> is treated as if it contained an XML document.</p>
<p>Returns the same result as the overload.</p>
<p>This is an overloaded function.</p>
<p>This function was introduced in  Qt 4.6.</p>
<!-- @@@setFocus -->
<!-- $$$setInitialTemplateName[overload1]$$$setInitialTemplateNameconstQXmlName& -->
<h3 class="fn"><a name="setInitialTemplateName"></a><span class="type">void</span> QXmlQuery::<span class="name">setInitialTemplateName</span>(const <span class="type"><a href="qxmlname.html">QXmlName</a></span> &amp;<i> name</i>)</h3>
<p>Sets the <i>name</i> of the initial template. The initial template is the one the processor calls first, instead of attempting to match a template to the context node (if any). If an initial template is not set, the standard order of template invocation will be used.</p>
<p>This function only applies when using <a href="qxmlquery.html">QXmlQuery</a> to process XSL-T stylesheets. The name becomes part of the compiled stylesheet. Therefore, this function must be called before calling <a href="qxmlquery.html#setQuery">setQuery</a>().</p>
<p>If the stylesheet has no template named <i>name</i>, the processor will use the standard order of template invocation.</p>
<p>This function was introduced in  Qt 4.5.</p>
<p><b>See also </b><a href="qxmlquery.html#initialTemplateName">initialTemplateName</a>().</p>
<!-- @@@setInitialTemplateName -->
<!-- $$$setInitialTemplateName$$$setInitialTemplateNameconstQString& -->
<h3 class="fn"><a name="setInitialTemplateName-2"></a><span class="type">void</span> QXmlQuery::<span class="name">setInitialTemplateName</span>(const <span class="type">QString</span> &amp;<i> localName</i>)</h3>
<p>This is an overloaded function.</p>
<p>Sets the name of the initial template to <i>localName</i>, which must be a valid <a href="qxmlname.html#localName">local name</a>. The initial template is the one the processor calls first, instead of attempting to match a template to the context node (if any). If an initial template is not set, the standard order of template invocation will be used.</p>
<p>This function only applies when using <a href="qxmlquery.html">QXmlQuery</a> to process XSL-T stylesheets. The name becomes part of the compiled stylesheet. Therefore, this function must be called before calling <a href="qxmlquery.html#setQuery">setQuery</a>().</p>
<p>If <i>localName</i> is not a valid <a href="qxmlname.html#localName">local name</a>, the effect is undefined. If the stylesheet has no template named <i>localName</i>, the processor will use the standard order of template invocation.</p>
<p>This function was introduced in  Qt 4.5.</p>
<p><b>See also </b><a href="qxmlquery.html#initialTemplateName">initialTemplateName</a>().</p>
<!-- @@@setInitialTemplateName -->
<!-- $$$setMessageHandler[overload1]$$$setMessageHandlerQAbstractMessageHandler* -->
<h3 class="fn"><a name="setMessageHandler"></a><span class="type">void</span> QXmlQuery::<span class="name">setMessageHandler</span>(<span class="type"><a href="qabstractmessagehandler.html">QAbstractMessageHandler</a></span> *<i> aMessageHandler</i>)</h3>
<p>Changes the <a href="qabstractmessagehandler.html">message handler</a> for this <a href="qxmlquery.html">QXmlQuery</a> to <i>aMessageHandler</i>. The query sends all compile and runtime messages to this message handler. <a href="qxmlquery.html">QXmlQuery</a> does not take ownership of <i>aMessageHandler</i>.</p>
<p>Normally, the default message handler is sufficient. It writes compile and runtime messages to <i>stderr</i>. The default message handler includes color codes if <i>stderr</i> can render colors.</p>
<p>Note that changing the message handler after the query has been compiled has no effect, i.e&#x2e; the query uses the same message handler at runtime that it uses at compile time.</p>
<p>When <a href="qxmlquery.html">QXmlQuery</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 >QtMsgType type</td><td >Only QtWarningMsg and QtFatalMsg are used. The former identifies a compile or runtime warning, while the latter identifies a dynamic or static 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>
<p><b>See also </b><a href="qxmlquery.html#messageHandler">messageHandler</a>().</p>
<!-- @@@setMessageHandler -->
<!-- $$$setNetworkAccessManager[overload1]$$$setNetworkAccessManagerQNetworkAccessManager* -->
<h3 class="fn"><a name="setNetworkAccessManager"></a><span class="type">void</span> QXmlQuery::<span class="name">setNetworkAccessManager</span>(<span class="type">QNetworkAccessManager</span> *<i> newManager</i>)</h3>
<p>Sets the network manager to <i>newManager</i>. <a href="qxmlquery.html">QXmlQuery</a> does not take ownership of <i>newManager</i>.</p>
<p>This function was introduced in  Qt 4.5.</p>
<p><b>See also </b><a href="qxmlquery.html#networkAccessManager">networkAccessManager</a>().</p>
<!-- @@@setNetworkAccessManager -->
<!-- $$$setQuery[overload1]$$$setQueryQIODevice*constQUrl& -->
<h3 class="fn"><a name="setQuery"></a><span class="type">void</span> QXmlQuery::<span class="name">setQuery</span>(<span class="type">QIODevice</span> *<i> sourceCode</i>, const <span class="type">QUrl</span> &amp;<i> documentURI</i> = QUrl())</h3>
<p>Sets this <a href="qxmlquery.html">QXmlQuery</a> to an <a href="xmlprocessing.html">XQuery</a> read from the <i>sourceCode</i> device. The device must have been opened with at least QIODevice::ReadOnly.</p>
<p><i>documentURI</i> represents the query obtained from the <i>sourceCode</i> device. It is the base URI of the static context, as defined in the <a href="http://www.w3.org/TR/xquery/">XQuery language</a>. It is used internally to resolve relative URIs that appear in the query, and for message reporting. <i>documentURI</i> can be empty. If it is empty, the application file path is used. If it is not empty, it may be either relative or absolute. If it is relative, it is resolved itself against the application file path before it is used. If <i>documentURI</i> is neither a valid URI nor empty, the result is undefined.</p>
<p>If the query contains a static error (e.g&#x2e; syntax error), an error message is sent to the <a href="qxmlquery.html#messageHandler">messageHandler</a>(), and <a href="qxmlquery.html#isValid">isValid</a>() will return <i>false</i>.</p>
<p>Variables must be bound before setQuery() is called.</p>
<p>The encoding of the <a href="xmlprocessing.html">XQuery</a> in <i>sourceCode</i> is detected internally using the rules for setting and detecting encoding of <a href="xmlprocessing.html">XQuery</a> files, which are explained in the <a href="http://www.w3.org/TR/xquery/">XQuery language</a>.</p>
<p>If <i>sourceCode</i> is <tt>null</tt> or not readable, or if <i>documentURI</i> is not a valid URI, behavior is undefined.</p>
<p><b>See also </b><a href="qxmlquery.html#isValid">isValid</a>().</p>
<!-- @@@setQuery -->
<!-- $$$setQuery$$$setQueryconstQUrl&constQUrl& -->
<h3 class="fn"><a name="setQuery-2"></a><span class="type">void</span> QXmlQuery::<span class="name">setQuery</span>(const <span class="type">QUrl</span> &amp;<i> queryURI</i>, const <span class="type">QUrl</span> &amp;<i> baseURI</i> = QUrl())</h3>
<p>Sets this <a href="qxmlquery.html">QXmlQuery</a> to the <a href="xmlprocessing.html">XQuery</a> read from the <i>queryURI</i>. Use <a href="qxmlquery.html#isValid">isValid</a>() after calling this function. If an error occurred reading <i>queryURI</i>, e.g&#x2e;, the query does not exist, cannot be read, or is invalid, <a href="qxmlquery.html#isValid">isValid</a>() will return <i>false</i>.</p>
<p>The supported URI schemes are the same as those in the <a href="xmlprocessing.html">XQuery</a> function <tt>fn:doc</tt>, except that queryURI can be the object of a variable binding.</p>
<p><i>baseURI</i> is the Base URI of the static context, as defined in the <a href="http://www.w3.org/TR/xquery/">XQuery language</a>. It is used internally to resolve relative URIs that appear in the query, and for message reporting. If <i>baseURI</i> is empty, <i>queryURI</i> is used. Otherwise, <i>baseURI</i> is used, and it is resolved against the application file path if it is relative.</p>
<p>If <i>queryURI</i> is empty or invalid, or if <i>baseURI</i> is invalid, the behavior of this function is undefined.</p>
<!-- @@@setQuery -->
<!-- $$$setQuery$$$setQueryconstQString&constQUrl& -->
<h3 class="fn"><a name="setQuery-3"></a><span class="type">void</span> QXmlQuery::<span class="name">setQuery</span>(const <span class="type">QString</span> &amp;<i> sourceCode</i>, const <span class="type">QUrl</span> &amp;<i> documentURI</i> = QUrl())</h3>
<p>This is an overloaded function.</p>
<p>The behavior and requirements of this function are the same as for setQuery(QIODevice*, const QUrl&amp;), after the <a href="xmlprocessing.html">XQuery</a> has been read from the IO device into a string. Because <i>sourceCode</i> is already a Unicode string, detection of its encoding is unnecessary.</p>
<!-- @@@setQuery -->
<!-- $$$setUriResolver[overload1]$$$setUriResolverconstQAbstractUriResolver* -->
<h3 class="fn"><a name="setUriResolver"></a><span class="type">void</span> QXmlQuery::<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="qxmlquery.html">QXmlQuery</a> does not take ownership of <i>resolver</i>.</p>
<p><b>See also </b><a href="qxmlquery.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> * QXmlQuery::<span class="name">uriResolver</span>() const</h3>
<p>Returns the query's URI resolver. If no URI resolver has been set, Qt XML Patterns will use the URIs in queries 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>Qt XML Patterns calls the URI resolver for all URIs it encounters, except for namespaces. Specifically, all builtin functions that deal with URIs (<tt>fn:doc()</tt>, and <tt>fn:doc-available()</tt>).</p>
<p>In the case of <tt>fn:doc()</tt>, the absolute URI is the base URI in the static context (which most likely is the location of the query). Rather than use the URI the user specified, the return value of <a href="qabstracturiresolver.html#resolve">QAbstractUriResolver::resolve</a>() will be used.</p>
<p>When Qt XML Patterns calls <a href="qabstracturiresolver.html#resolve">QAbstractUriResolver::resolve</a>() the absolute URI is the URI mandated by the <a href="xmlprocessing.html">XQuery</a> language, and the relative URI is the URI specified by the user.</p>
<p><b>See also </b><a href="qxmlquery.html#setUriResolver">setUriResolver</a>().</p>
<!-- @@@uriResolver -->
<!-- $$$operator=[overload1]$$$operator=constQXmlQuery& -->
<h3 class="fn"><a name="operator-eq"></a><span class="type">QXmlQuery</span> &amp; QXmlQuery::<span class="name">operator=</span>(const <span class="type">QXmlQuery</span> &amp;<i> other</i>)</h3>
<p>Assigns <i>other</i> to this <a href="qxmlquery.html">QXmlQuery</a> instance.</p>
<!-- @@@operator= -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2014 Digia Plc and/or its
   subsidiaries. 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>    Digia, Qt and their respective logos are trademarks of Digia Plc     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>