Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > f49fc73010cecd092040182d92a8ff8e > files > 95

qtxmlpatterns5-doc-5.12.6-1.mga7.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" />
<!-- qxmlquery.cpp -->
  <title>QXmlQuery Class | Qt XML Patterns 5.12.6</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.12</td><td ><a href="qtxmlpatterns-index.html">Qt XML Patterns</a></td><td ><a href="qtxmlpatterns-module.html">C++ Classes</a></td><td >QXmlQuery</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtxmlpatterns-index.html">Qt 5.12.6 Reference Documentation</a></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-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>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QXmlQuery Class</h1>
<!-- $$$QXmlQuery-brief -->
<p>The <a href="qxmlquery.html">QXmlQuery</a> class performs XQueries on XML data, or on non-XML data modeled to look like XML. <a href="#details">More...</a></p>
<!-- @@@QXmlQuery -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QXmlQuery&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.4</td></tr></table></div><ul>
<li><a href="qxmlquery-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-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><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></div>
<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="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-1">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-2">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-3">QXmlQuery</a></b>(QXmlQuery::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-1">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-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 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-4">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-5">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-1">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-2">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-3">evaluateTo</a></b>(QIODevice *<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"> 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"> QXmlQuery::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-1">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-2">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-3">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-1">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-1">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#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#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></div>
<a name="details"></a>
<!-- $$$QXmlQuery-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qxmlquery.html">QXmlQuery</a> class performs XQueries on XML data, or on non-XML data modeled to look like XML.</p>
<p>The <a href="qxmlquery.html">QXmlQuery</a> class compiles and executes queries written in the <a href="http://www.w3.org/TR/xquery/">XQuery language</a>. <a href="qxmlquery.html">QXmlQuery</a> 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 <a href="qxmlquery.html">QXmlQuery</a> 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"><a href="qxmlquery.html#QXmlQuery">QXmlQuery</a></span> query;
  query<span class="operator">.</span>setQuery(<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>evaluateTo(<span class="operator">&amp;</span>serializer);

</pre>
<p>The example uses <a href="qxmlquery.html">QXmlQuery</a> 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 <a href="qxmlquery.html">QXmlQuery</a> 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 <a href="qxmlquery.html">QXmlQuery</a> to query non-XML data, see the documentation for <a href="qabstractxmlnodemodel.html">QAbstractXmlNodeModel</a>.</p>
<a name="running-xqueries"></a>
<h3 id="running-xqueries">Running XQueries</h3>
<p>To run a query set up with <a href="qxmlquery.html">QXmlQuery</a>, call one of the evaluation functions.</p>
<ul>
<li><a href="qxmlquery.html#evaluateTo">evaluateTo</a>(QAbstractXmlReceiver *) is called with a pointer to an XML receiver, 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><a href="qxmlquery.html#evaluateTo">evaluateTo</a>(<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><a href="qxmlquery.html#evaluateTo">evaluateTo</a>(QStringList *) is like <a href="qxmlquery.html#evaluateTo">evaluateTo</a>(<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 id="running-xpath-expressions">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 <a href="qxmlquery.html">QXmlQuery</a> using <a href="qxmlquery.html#setQuery">setQuery</a>().</p>
<a name="running-xslt-stylesheets"></a>
<h3 id="running-xslt-stylesheets">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 <a href="qxmlquery.html">QXmlQuery</a>, you must pass <a href="qxmlquery.html#QueryLanguage-enum">QXmlQuery::XSLT20</a> to tell <a href="qxmlquery.html">QXmlQuery</a> 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"><a href="qxmlquery.html#QXmlQuery">QXmlQuery</a></span> query(<span class="type"><a href="qxmlquery.html#QXmlQuery">QXmlQuery</a></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 <code>xmlpatterns</code> 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 id="binding-a-query-to-a-starting-node">Binding A Query To A Starting Node</h3>
<p>When a query is run on XML data, as in the snippet above, the <code>doc()</code> 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 id="reentrancy-and-thread-safety">Reentrancy and Thread-Safety</h3>
<p><a href="qxmlquery.html">QXmlQuery</a> 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, <a href="qxmlquery.html">QXmlQuery</a> 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 <a href="qxmlquery.html">QXmlQuery</a> in multiple threads.</p>
<a name="error-handling"></a>
<h3 id="error-handling">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 <code>true</code>, or <a href="qxmlquery.html#evaluateTo">evaluateTo</a>() will return <code>false</code>;</li>
<li>The results of the evaluation are undefined.</li>
</ul>
<a name="resource-management"></a>
<h3 id="resource-management">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 <a href="qxmlquery.html">QXmlQuery</a> for each query text.</p>
<p>Once a document has been parsed, its internal representation is maintained in the <a href="qxmlquery.html">QXmlQuery</a> instance and shared among multiple <a href="qxmlquery.html">QXmlQuery</a> instances.</p>
<p>An instance of QCoreApplication must exist before <a href="qxmlquery.html">QXmlQuery</a> can be used.</p>
<a name="event-handling"></a>
<h3 id="event-handling">Event Handling</h3>
<p>When <a href="qxmlquery.html">QXmlQuery</a> accesses resources (e.g&#x2e;, calling <code>fn:doc()</code> 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 <a href="qxmlquery.html">QXmlQuery</a> accesses resources, create your <a href="qxmlquery.html">QXmlQuery</a> 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" id="QueryLanguage-enum"><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>
<div class="table"><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"><code>QXmlQuery::XQuery10</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign"><a href="xmlprocessing.html">XQuery</a> 1.0&#x2e;</td></tr>
<tr><td class="topAlign"><code>QXmlQuery::XSLT20</code></td><td class="topAlign tblval"><code>2</code></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></div>
<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" id="QXmlQuery"><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" id="QXmlQuery-1"><a name="QXmlQuery-1"></a>QXmlQuery::<span class="name">QXmlQuery</span>(const <span class="type"><a href="qxmlquery.html#QXmlQuery">QXmlQuery</a></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" id="QXmlQuery-2"><a name="QXmlQuery-2"></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$$$QXmlQueryQXmlQuery::QueryLanguageconstQXmlNamePool& -->
<h3 class="fn" id="QXmlQuery-3"><a name="QXmlQuery-3"></a>QXmlQuery::<span class="name">QXmlQuery</span>(<span class="type"><a href="qxmlquery.html#QueryLanguage-enum">QXmlQuery::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" id="dtor.QXmlQuery"><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" id="bindVariable"><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$$$bindVariableconstQString&constQXmlItem& -->
<h3 class="fn" id="bindVariable-1"><a name="bindVariable-1"></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> 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> value);

</pre>
<!-- @@@bindVariable -->
<!-- $$$bindVariable$$$bindVariableconstQXmlName&QIODevice* -->
<h3 class="fn" id="bindVariable-2"><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 <code>xs:anyURI</code>, which can be passed to the <code>fn:doc()</code> function to be read. E.g&#x2e;, this function can be used to pass an XML document in memory to <code>fn:doc</code>.</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">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 <code>&lt;document&gt;content&lt;/document&gt;</code></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">QXmlQuery</a></span> query;
      query<span class="operator">.</span>setQuery(<span class="string">&quot;doc($inputDocument)/query[theDocument]&quot;</span>);
      query<span class="operator">.</span>bindVariable(<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 <code>false</code>, 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$$$bindVariableconstQString&QIODevice* -->
<h3 class="fn" id="bindVariable-3"><a name="bindVariable-3"></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$$$bindVariableconstQXmlName&constQXmlQuery& -->
<h3 class="fn" id="bindVariable-4"><a name="bindVariable-4"></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="qxmlquery.html#QXmlQuery">QXmlQuery</a></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&constQXmlQuery& -->
<h3 class="fn" id="bindVariable-5"><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>, const <span class="type"><a href="qxmlquery.html#QXmlQuery">QXmlQuery</a></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" id="evaluateTo"><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" id="evaluateTo-1"><a name="evaluateTo-1"></a><span class="type">bool</span> QXmlQuery::<span class="name">evaluateTo</span>(<span class="type">QAbstractXmlReceiver</span> *<i>callback</i>) const</h3>
<p>Evaluates this query and sends the result as a sequence of callbacks to the receiver <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 <code>false</code> is returned.</p>
<p>If this query <a href="qxmlquery.html#isValid">is invalid</a>, <code>false</code> is returned and the behavior is undefined. If <i>callback</i> is null, behavior is undefined.</p>
<p><b>See also </b>QAbstractXmlReceiver and <a href="qxmlquery.html#isValid">isValid</a>().</p>
<!-- @@@evaluateTo -->
<!-- $$$evaluateTo$$$evaluateToQStringList* -->
<h3 class="fn" id="evaluateTo-2"><a name="evaluateTo-2"></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 <code>xs:string</code> values. If the query does not evaluate to a sequence of strings, the values can often be converted by adding a call to <code>string()</code> 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$$$evaluateToQIODevice* -->
<h3 class="fn" id="evaluateTo-3"><a name="evaluateTo-3"></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 <code>false</code> is returned.</p>
<p>If <i>target</i> is <code>null</code>, 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 -->
<!-- $$$evaluateTo$$$evaluateToQString* -->
<h3 class="fn" id="evaluateTo-4"><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 <code>false</code> is returned, otherwise <code>true</code> is returned.</p>
<p>If <i>output</i> is <code>null</code> 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 -->
<!-- $$$initialTemplateName[overload1]$$$initialTemplateName -->
<h3 class="fn" id="initialTemplateName"><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" id="isValid"><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" id="messageHandler"><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" id="namePool"><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" id="networkAccessManager"><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" id="queryLanguage"><a name="queryLanguage"></a><span class="type"><a href="qxmlquery.html#QueryLanguage-enum">QXmlQuery::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" id="setFocus"><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, <code>XPDY0002</code>, 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" id="setFocus-1"><a name="setFocus-1"></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" id="setFocus-2"><a name="setFocus-2"></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" id="setFocus-3"><a name="setFocus-3"></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" id="setInitialTemplateName"><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" id="setInitialTemplateName-1"><a name="setInitialTemplateName-1"></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" id="setMessageHandler"><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>
<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 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></div>
<p><b>See also </b><a href="qxmlquery.html#messageHandler">messageHandler</a>().</p>
<!-- @@@setMessageHandler -->
<!-- $$$setNetworkAccessManager[overload1]$$$setNetworkAccessManagerQNetworkAccessManager* -->
<h3 class="fn" id="setNetworkAccessManager"><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" id="setQuery"><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 <code>null</code> 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$$$setQueryconstQString&constQUrl& -->
<h3 class="fn" id="setQuery-1"><a name="setQuery-1"></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 <a href="qxmlquery.html#setQuery">setQuery</a>(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 -->
<!-- $$$setQuery$$$setQueryconstQUrl&constQUrl& -->
<h3 class="fn" id="setQuery-2"><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 <code>fn:doc</code>, 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 -->
<!-- $$$setUriResolver[overload1]$$$setUriResolverconstQAbstractUriResolver* -->
<h3 class="fn" id="setUriResolver"><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" id="uriResolver"><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 (<code>fn:doc()</code>, and <code>fn:doc-available()</code>).</p>
<p>In the case of <code>fn:doc()</code>, 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" id="operator-eq"><a name="operator-eq"></a><span class="type"><a href="qxmlquery.html#QXmlQuery">QXmlQuery</a></span> &amp;QXmlQuery::<span class="name">operator=</span>(const <span class="type"><a href="qxmlquery.html#QXmlQuery">QXmlQuery</a></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> 2019 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>