Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 518

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QAbstractXmlNodeModel Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QAbstractXmlNodeModel Class Reference<br /><sup><sup>[<a href="qtxmlpatterns.html">QtXmlPatterns</a> module]</sup></sup></h1><p>The QAbstractXmlNodeModel class is an abstract base class for
modeling non-XML data to look like XML for <a href="qxmlquery.html">QXmlQuery</a>. <a href="#details">More...</a></p>

<p>Inherited by <a href="qsimplexmlnodemodel.html">QSimpleXmlNodeModel</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qabstractxmlnodemodel.html#SimpleAxis-enum">SimpleAxis</a></b> { Parent, FirstChild, PreviousSibling, NextSibling }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qabstractxmlnodemodel.html#QAbstractXmlNodeModel">__init__</a></b> (<i>self</i>)</li><li><div class="fn" />list-of-QXmlNodeModelIndex <b><a href="qabstractxmlnodemodel.html#attributes">attributes</a></b> (<i>self</i>, QXmlNodeModelIndex&#160;<i>element</i>)</li><li><div class="fn" />QUrl <b><a href="qabstractxmlnodemodel.html#baseUri">baseUri</a></b> (<i>self</i>, QXmlNodeModelIndex&#160;<i>ni</i>)</li><li><div class="fn" />QXmlNodeModelIndex.DocumentOrder <b><a href="qabstractxmlnodemodel.html#compareOrder">compareOrder</a></b> (<i>self</i>, QXmlNodeModelIndex&#160;<i>ni1</i>, QXmlNodeModelIndex&#160;<i>ni2</i>)</li><li><div class="fn" />QXmlNodeModelIndex <b><a href="qabstractxmlnodemodel.html#createIndex">createIndex</a></b> (<i>self</i>, int&#160;<i>data</i>)</li><li><div class="fn" />QXmlNodeModelIndex <b><a href="qabstractxmlnodemodel.html#createIndex-2">createIndex</a></b> (<i>self</i>, int&#160;<i>data</i>, int&#160;<i>additionalData</i>)</li><li><div class="fn" />QXmlNodeModelIndex <b><a href="qabstractxmlnodemodel.html#createIndex-3">createIndex</a></b> (<i>self</i>, object&#160;<i>pointer</i>, int&#160;<i>additionalData</i>&#160;=&#160;0)</li><li><div class="fn" />QUrl <b><a href="qabstractxmlnodemodel.html#documentUri">documentUri</a></b> (<i>self</i>, QXmlNodeModelIndex&#160;<i>ni</i>)</li><li><div class="fn" />QXmlNodeModelIndex <b><a href="qabstractxmlnodemodel.html#elementById">elementById</a></b> (<i>self</i>, QXmlName&#160;<i>NCName</i>)</li><li><div class="fn" />QXmlNodeModelIndex.NodeKind <b><a href="qabstractxmlnodemodel.html#kind">kind</a></b> (<i>self</i>, QXmlNodeModelIndex&#160;<i>ni</i>)</li><li><div class="fn" />QXmlName <b><a href="qabstractxmlnodemodel.html#name">name</a></b> (<i>self</i>, QXmlNodeModelIndex&#160;<i>ni</i>)</li><li><div class="fn" />list-of-QXmlName <b><a href="qabstractxmlnodemodel.html#namespaceBindings">namespaceBindings</a></b> (<i>self</i>, QXmlNodeModelIndex&#160;<i>n</i>)</li><li><div class="fn" />QXmlNodeModelIndex <b><a href="qabstractxmlnodemodel.html#nextFromSimpleAxis">nextFromSimpleAxis</a></b> (<i>self</i>, SimpleAxis&#160;<i>axis</i>, QXmlNodeModelIndex&#160;<i>origin</i>)</li><li><div class="fn" />list-of-QXmlNodeModelIndex <b><a href="qabstractxmlnodemodel.html#nodesByIdref">nodesByIdref</a></b> (<i>self</i>, QXmlName&#160;<i>NCName</i>)</li><li><div class="fn" />QXmlNodeModelIndex <b><a href="qabstractxmlnodemodel.html#root">root</a></b> (<i>self</i>, QXmlNodeModelIndex&#160;<i>n</i>)</li><li><div class="fn" />QSourceLocation <b><a href="qabstractxmlnodemodel.html#sourceLocation">sourceLocation</a></b> (<i>self</i>, QXmlNodeModelIndex&#160;<i>index</i>)</li><li><div class="fn" />QString <b><a href="qabstractxmlnodemodel.html#stringValue">stringValue</a></b> (<i>self</i>, QXmlNodeModelIndex&#160;<i>n</i>)</li><li><div class="fn" />QVariant <b><a href="qabstractxmlnodemodel.html#typedValue">typedValue</a></b> (<i>self</i>, QXmlNodeModelIndex&#160;<i>n</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QAbstractXmlNodeModel class is an abstract base class for
modeling non-XML data to look like XML for <a href="qxmlquery.html">QXmlQuery</a>.</p>
<p>The QAbstractXmlNodeModel specifies the interface that a node
model must implement for that node model be accessible to the query
engine for processing <a href="xmlprocessing.html">XQuery</a>
queries. A node model represents data as a structure that can be
queried as if the data were XML.</p>
<p>The node model represented by a subclass of
QAbstractXmlNodeModel is meant to be accessed by the <a href="qtxmlpatterns.html">QtXmlPatterns</a> query engine. If the API
seems a little strange in a few places, it is because the member
functions are called by the query engine as it evaluates an
<a href="xmlprocessing.html">XQuery</a>. They aren't meant to be
used programatically.</p>
<a id="usage" name="usage" />
<h3>Usage</h3>
<p>QAbstractXmlNodeModel bridges the gap between the arbitrary
structure of the non-XML data to be queried and the well-defined
structure of XML data understood by <a href="qxmlquery.html">QXmlQuery</a>.</p>
<p>Consider a chemistry application that reads the file
<tt>chemistryData</tt>, which contains non-XML data that represents
a chemical structure composed of molecules and atoms. The
application will query this chemistry data with an <a href="xmlprocessing.html">XQuery</a> it reads from file
<tt>queryFile</tt>. We write a custom subclass of
QAbstractXmlNodeModel (<tt>ChemistryNodeModel</tt>) that reads
<tt>chemistryData</tt> and builds a data structure, perhaps
composed of objects of our own classes <tt>molecule</tt> and
<tt>atom</tt>. Clearly, this data structure is not XML. Our custom
subclass will know how to traverse this non-XML structure and
present it through the <a href="http://www.w3.org/TR/xpath-datamodel/">XPath Data Model
interface</a>.</p>
<pre class="cpp">
 <span class="type"><a href="qfile.html">QFile</a></span> queryFile(argv<span class="operator">[</span><span class="number">1</span><span class="operator">]</span>);
 <span class="type"><a href="qfile.html">QFile</a></span> chemistryData(argv<span class="operator">[</span><span class="number">2</span><span class="operator">]</span>);
 <span class="type"><a href="qstring.html">QString</a></span> moleculeName <span class="operator">=</span> argv<span class="operator">[</span><span class="number">3</span><span class="operator">]</span>;

 <span class="type"><a href="qxmlquery.html">QXmlQuery</a></span> query;
 query<span class="operator">.</span>setQuery(<span class="operator">&amp;</span>queryFile<span class="operator">,</span> <span class="type"><a href="qurl.html">QUrl</a></span><span class="operator">.</span>fromLocalFile(queryFile<span class="operator">.</span>fileName()));

 ChemistryNodeModel myNodeModel(query<span class="operator">.</span>namePool()<span class="operator">,</span> chemistryData);
 <span class="type"><a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a></span> startNode <span class="operator">=</span> myNodeModel<span class="operator">.</span>nodeFor(moleculeName);
 query<span class="operator">.</span>bindVariable(<span class="string">"queryRoot"</span><span class="operator">,</span> startNode);

 <span class="type"><a href="qfile.html">QFile</a></span> out;
 out<span class="operator">.</span>open(stdout<span class="operator">,</span> <span class="type"><a href="qiodevice.html">QIODevice</a></span><span class="operator">.</span>WriteOnly);

 <span class="type"><a href="qxmlserializer.html">QXmlSerializer</a></span> serializer(query<span class="operator">,</span> <span class="operator">&amp;</span>out);
 query<span class="operator">.</span>evaluateTo(<span class="operator">&amp;</span>serializer);
</pre>
<p>The application first creates an instance of <a href="qxmlquery.html">QXmlQuery</a> and calls <a href="qxmlquery.html#setQuery">setQuery()</a> to read <tt>queryFile</tt>
containing the <a href="xmlprocessing.html">XQuery</a> we want to
run. Then it creates an instance of our custom node model class,
<tt>ChemistryNodeModel</tt>, which is a subclass of
QAbstractXmlNodeModel. Its constructor is called with the <a href="qxmlnamepool.html">name pool</a> obtained from our <a href="qxmlquery.html">QXmlQuery</a>, and with the <tt>chemistryFile</tt>
containing the structure of molecules and atoms to be queried. The
<a href="qxmlnamepool.html">name pool</a> is required because our
custom node model has the member function <a href="qabstractxmlnodemodel.html#name">name()</a>, which returns the
<a href="qxmlname.html">name</a> of any node in the model. The
<a href="qxmlquery.html">query</a> and the custom node model must
use the same name pool for constructing these <a href="qxmlname.html">names</a>. The constructor would then read
<tt>chemistryFile</tt> and build the custom node model
structure.</p>
<p>To connect the <tt>query</tt> to the custom node model, we must
bind a variable name used in the query to a node in the model. The
variable can then be used in the query as a starting node. First,
an <a href="qxmlnodemodelindex.html">index</a> for the desired
starting node is retrieved by calling <a href="qabstractxmlnodemodel.html#createIndex">QAbstractXmlNodeModel.createIndex</a>().
Then the index is bound to a variable name, in this case
<tt>queryRoot</tt>, by passing the name and the index to <a href="qxmlquery.html#bindVariable">QXmlQuery.bindVariable</a>(). The
query can then use a variable reference <tt>$queryRoot</tt> to
refer to the starting node. Note that if the <a href="qxmlquery.html">query</a> uses multiple variable references, a
call to <a href="qxmlquery.html#bindVariable">QXmlQuery.bindVariable</a>() is
required to bind each different variable name to a node in the
model.</p>
<p>The query is executed when the application calls one of the
<a href="qxmlquery.html">QXmlQuery</a> evaluation functions. The
application uses QXmlQuery.evaluateTo(<a href="qabstractxmlreceiver.html">QAbstractXmlReceiver</a> *), because it
then uses a <a href="qxmlserializer.html">serializer</a> to out the
query result as XML to <tt>stdout</tt>. We could have used
QXmlQuery.evaluateTo(<a href="qxmlresultitems.html">QXmlResultItems</a> *) to get a list of
result items, or QXmlQuery.evaluateTo(<a href="qstringlist.html">QStringList</a> *) if the query evaluated to a
sequence of <tt>xs:string</tt> values.</p>
<p>During query execution, the engine iterates over the node model
using <a href="qabstractxmlnodemodel.html#nextFromSimpleAxis">nextFromSimpleAxis</a>()
to get the <a href="qxmlnodemodelindex.html">index</a> of the next
node to be visited. The engine can get the name of a node by
calling <a href="qabstractxmlnodemodel.html#name">name</a>() with
the node's <a href="qxmlnodemodelindex.html">index</a>. <a href="qabstractxmlnodemodel.html#stringValue">stringValue</a>(),
<a href="qabstractxmlnodemodel.html#baseUri">baseUri</a>(),
<a href="qabstractxmlnodemodel.html#documentUri">documentUri</a>()
and <a href="qabstractxmlnodemodel.html#kind">kind</a>() are also
called as needed with a node <a href="qxmlnodemodelindex.html">index</a>.</p>
<p>The example demonstrates the standard pattern for using a
subclass of QAbstractXmlNodeModel in combination with <a href="qxmlquery.html">QXmlQuery</a> to perform an <a href="xmlprocessing.html">XQuery</a>.</p>
<ol class="1">
<li>Instantiate <a href="qxmlquery.html">QXmlQuery</a> and give it
the <a href="xmlprocessing.html">XQuery</a> to be run;</li>
<li>Instantiate a subclass of QAbstractXmlNodeModel or <a href="qsimplexmlnodemodel.html">QSimpleXmlNodeModel</a>;</li>
<li>Retrieve a <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a> for the node in
the model where the <a href="qxmlquery.html">QXmlQuery</a> should
start the query;</li>
<li>Use <a href="qxmlquery.html#bindVariable">QXmlQuery.bindVariable</a>() to bind
the <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a> to
<tt>$variable name</tt>;</li>
<li>Call one of the <a href="qxmlquery.html">QXmlQuery</a>
evaluation functions to run the query.</li>
</ol>
<a id="subclassing" name="subclassing" />
<h3>Subclassing</h3>
<p>Because the <a href="http://www.w3.org/TR/xpath-datamodel/">XPath Data Model
interface</a> presented by QAbstractXmlNodeModel allows <a href="qxmlquery.html">QXmlQuery</a> to operate on non-XML data as if it
were XML, implementing subclasses of QAbstractXmlNodeModel can
involve a significant amount of work. The <a href="qsimplexmlnodemodel.html">QSimpleXmlNodeModel</a> class is
provided to simplify the implementation for many common use
cases.</p>
<a id="thread-safety" name="thread-safety" />
<h3>Thread Safety</h3>
<p>Because the node model can be accessed concurrently by threads
in the <a href="qtxmlpatterns.html">QtXmlPatterns</a> module,
subclasses of QAbstractXmlNodeModel must be written to be <a href="threads-reentrancy.html">thread-safe</a>. Classes that simplify
implementing thread-safety include <a href="qreadlocker.html">QReadLocker</a> and <a href="qwritelocker.html">QWriteLocker</a>.</p>
<p>See the example <a href="xmlpatterns-filetree.html">File System
Example</a> for a demonstration.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="SimpleAxis-enum" />QAbstractXmlNodeModel.SimpleAxis</h3><p>Four axes that each contain one node only.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QAbstractXmlNodeModel.Parent</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">The parent of the context node</td>
</tr>
<tr>
<td class="topAlign">
<tt>QAbstractXmlNodeModel.FirstChild</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">The first child of the context node</td>
</tr>
<tr>
<td class="topAlign">
<tt>QAbstractXmlNodeModel.PreviousSibling</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">The previous child of the context node</td>
</tr>
<tr>
<td class="topAlign">
<tt>QAbstractXmlNodeModel.NextSibling</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign">The next child of the context node</td>
</tr>
</table>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QAbstractXmlNodeModel" />QAbstractXmlNodeModel.__init__ (<i>self</i>)</h3><p>Default constructor.</p>


<h3 class="fn"><a name="attributes" />list-of-QXmlNodeModelIndex QAbstractXmlNodeModel.attributes (<i>self</i>, <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a>&#160;<i>element</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the attributes of <i>element</i>. The caller guarantees
that <i>element</i> is an element in this node model.</p>


<h3 class="fn"><a name="baseUri" /><a href="qurl.html">QUrl</a> QAbstractXmlNodeModel.baseUri (<i>self</i>, <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a>&#160;<i>ni</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the base URI for the node whose index is <i>n</i>. The
caller guarantees that <i>n</i> is not <tt>null</tt> and that it
belongs to a node in this node model.</p>
<p>The base URI of a node can be extracted using the
<tt>fn:base-uri()</tt> function. The base URI is typically used for
resolving relative URIs that appear in the node or its children. It
is conformant to just return the document URI, although that might
not properly reflect the underlying data.</p>
<p>This function maps to the <tt>dm:base-uri</tt> accessor, which
returns a base URI according to the following:</p>
<ul>
<li>For document nodes, the base URI and the document URI are the
same.</li>
<li>For elements, the base URI is the URI appearing in the
element's <tt>xml:base</tt> attribute, if present, or it is
resolved to the parent element's base URI.</li>
<li>Namespace nodes have no base URI.</li>
<li>The base URI for a processing instruction, comment, attribute,
or text node is the base URI of the node's parent element.</li>
</ul>
<p>The implementation guarantees to return a valid <a href="qurl.html">QUrl</a>, or a default constructed <a href="qurl.html">QUrl</a>. If a node has no base URI, as in the case
where a comment has no parent, a default constructed <a href="qurl.html">QUrl</a> is returned.</p>
<p><b>See also</b> <a href="http://www.w3.org/TR/xpath-datamodel/#dm-base-uri">XQuery 1.0 and
XPath 2.0 Data Model (XDM), 5.2 base-uri Accessor</a>.</p>


<h3 class="fn"><a name="compareOrder" /><a href="qxmlnodemodelindex.html#DocumentOrder-enum">QXmlNodeModelIndex.DocumentOrder</a> QAbstractXmlNodeModel.compareOrder (<i>self</i>, <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a>&#160;<i>ni1</i>, <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a>&#160;<i>ni2</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>This function returns the relative document order for the nodes
indexed by <i>ni1</i> and <i>ni2</i>. It is used for the
<tt>Is</tt> operator and for sorting nodes in document order.</p>
<p>The caller guarantees that <i>ni1</i> and <i>ni2</i> are not
<tt>null</tt> and that both identify nodes in this node model.</p>
<p>If <i>ni1</i> is identical to <i>ni2</i>, <a href="qxmlnodemodelindex.html#DocumentOrder-enum">QXmlNodeModelIndex.Is</a>
is returned. If <i>ni1</i> precedes <i>ni2</i> in document order,
<a href="qxmlnodemodelindex.html#DocumentOrder-enum">QXmlNodeModelIndex.Precedes</a>
is returned. If <i>ni1</i> follows <i>ni2</i> in document order,
<a href="qxmlnodemodelindex.html#DocumentOrder-enum">QXmlNodeModelIndex.Follows</a>
is returned.</p>
<p><b>See also</b> <a href="http://www.w3.org/TR/xpath-datamodel/#document-order">XQuery 1.0
and XPath 2.0 Data Model (XDM), 2.4 Document Order</a>.</p>


<h3 class="fn"><a name="createIndex" /><a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a> QAbstractXmlNodeModel.createIndex (<i>self</i>, int&#160;<i>data</i>)</h3><p>Creates a node index with <i>data</i> as its internal data.
<i>data</i> is not constrained.</p>


<h3 class="fn"><a name="createIndex-2" /><a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a> QAbstractXmlNodeModel.createIndex (<i>self</i>, int&#160;<i>data</i>, int&#160;<i>additionalData</i>)</h3><p>Creates a node index with <i>pointer</i> and
<i>additionalData</i> as its internal data.</p>
<p>What <i>pointer</i> and <i>additionalData</i> is, is not
constrained.</p>


<h3 class="fn"><a name="createIndex-3" /><a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a> QAbstractXmlNodeModel.createIndex (<i>self</i>, object&#160;<i>pointer</i>, int&#160;<i>additionalData</i>&#160;=&#160;0)</h3><p>This is an overloaded function.</p>
<p>Creates a <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a> containing
<i>data</i> and <i>additionalData</i>.</p>


<h3 class="fn"><a name="documentUri" /><a href="qurl.html">QUrl</a> QAbstractXmlNodeModel.documentUri (<i>self</i>, <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a>&#160;<i>ni</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the document URI of <i>n</i>. The document URI
identifies the resource which is the document. For example, the
document could be a regular file, e.g., <tt>file:/</tt>, or it
could be the <tt>http://</tt> URL of the location of a file. The
document URI is used for resolving URIs and to simply know where
the document is.</p>
<p>If the node model maps to a URI in a natural way, return that
URI. Otherwise, return the company or product URI. The document URI
can be any URI as long as its valid and absolute.</p>
<p>The caller guarantees that <i>n</i> is not <tt>null</tt> and
that it belongs to this <a href="qabstractxmlnodemodel.html">QAbstractXmlNodeModel</a>.</p>
<p>This function maps to the <tt>dm:document-uri</tt> accessor,
which returns a document URI according to the following:</p>
<ul>
<li>If <i>n</i> is a document node, return an absolute <a href="qurl.html">QUrl</a> containing the document URI, or a default
constructed <a href="qurl.html">QUrl</a>. The latter signals that
no document URI is available for the document node.</li>
<li>For all other nodes, return a default constructed <a href="qurl.html">QUrl</a>.</li>
</ul>
<p><b>See also</b> <a href="http://www.w3.org/TR/xpath-datamodel/#dm-document-uri">XQuery 1.0
and XPath 2.0 Data Model (XDM), 5.4 document-uri Accessor</a>,
<a href="qurl.html#isValid">QUrl.isValid</a>(), and <a href="qurl.html#isRelative">QUrl.isRelative</a>().</p>


<h3 class="fn"><a name="elementById" /><a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a> QAbstractXmlNodeModel.elementById (<i>self</i>, <a href="qxmlname.html">QXmlName</a>&#160;<i>NCName</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the index of the element identified as <i>id</i>.
<a href="xmlprocessing.html">XQuery</a>'s <tt>id()</tt> function
calls this function.</p>
<p>The node index returned will be the element node whose value is
of type <tt>ID</tt> and equals <i>id</i>, or it will be the element
node that has an attribute whose typed value is of type <tt>ID</tt>
and equals <i>id</i>. If there is no such element, a default
constructed <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a> instance is
returned. The implementor guarantees that if the returned node
index is not null, it identifies an element.</p>
<p>It is not sufficient for an attribute or element to merely be
called <tt>id</tt>. Its value type must also be <tt>ID</tt>.
However, the reserved name <tt>xml:id</tt> is sufficient.</p>
<p>In <i>id</i>, the <tt>namespace URI</tt> and the <tt>prefix</tt>
are undefined, and the <tt>local name</tt> is the ID that should be
looked up.</p>
<p><b>See also</b> <a href="http://www.w3.org/TR/xpath-functions/#func-id">XQuery 1.0 and
XPath 2.0 Functions and Operators, 15.5.2 fn:id</a>.</p>


<h3 class="fn"><a name="kind" /><a href="qxmlnodemodelindex.html#NodeKind-enum">QXmlNodeModelIndex.NodeKind</a> QAbstractXmlNodeModel.kind (<i>self</i>, <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a>&#160;<i>ni</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns a value indicating the kind of node identified by
<i>ni</i>. The caller guarantees that <i>ni</i> is not null and
that it identifies a node in this node model. This function maps to
the <tt>dm:node-kind()</tt> accessor.</p>
<p><b>See also</b> <a href="http://www.w3.org/TR/xpath-datamodel/#dm-node-kind">XQuery 1.0 and
XPath 2.0 Data Model (XDM), 5.10 node-kind Accessor</a>.</p>


<h3 class="fn"><a name="name" /><a href="qxmlname.html">QXmlName</a> QAbstractXmlNodeModel.name (<i>self</i>, <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a>&#160;<i>ni</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the name of <i>ni</i>. The caller guarantees that
<i>ni</i> is not <tt>null</tt> and that it belongs to this <a href="qabstractxmlnodemodel.html">QAbstractXmlNodeModel</a>.</p>
<p>If a node does not have a name, e.g., comment nodes, a null
<a href="qxmlname.html">QXmlName</a> is returned. QXmlNames must be
created with the instance of <a href="qxmlquery.html">QXmlQuery</a>
that is being used for evaluating queries using this <a href="qabstractxmlnodemodel.html">QAbstractXmlNodeModel</a>.</p>
<p>This function maps to the <tt>dm:node-name()</tt> accessor.</p>
<p>If <i>ni</i> is a processing instruction, a <a href="qxmlname.html">QXmlName</a> is returned with the local name as the
target name and the namespace URI and prefix both empty.</p>
<p><b>See also</b> <a href="http://www.w3.org/TR/xpath-datamodel/#dm-node-name">XQuery 1.0 and
XPath 2.0 Data Model (XDM), 5.11 node-name Accessor</a> and
<a href="qxmlname.html">QXmlName</a>.</p>


<h3 class="fn"><a name="namespaceBindings" />list-of-QXmlName QAbstractXmlNodeModel.namespaceBindings (<i>self</i>, <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a>&#160;<i>n</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the in-scope namespaces of <i>n</i>. The caller
guarantees that <i>n</i> is not <tt>null</tt> and that it belongs
to this <a href="qabstractxmlnodemodel.html">QAbstractXmlNodeModel</a>.</p>
<p>This function corresponds to the <tt>dm:namespace-nodes</tt>
accessor.</p>
<p>The returned vector of namespace declarations includes
namespaces of the ancestors of <i>n</i>.</p>
<p>The caller guarantees that <i>n</i> is an Element that belongs
to this <a href="qabstractxmlnodemodel.html">QAbstractXmlNodeModel</a>.</p>


<h3 class="fn"><a name="nextFromSimpleAxis" /><a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a> QAbstractXmlNodeModel.nextFromSimpleAxis (<i>self</i>, <a href="qabstractxmlnodemodel.html#SimpleAxis-enum">SimpleAxis</a>&#160;<i>axis</i>, <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a>&#160;<i>origin</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>When <a href="qtxmlpatterns.html">QtXmlPatterns</a> evaluate
path expressions, it emulate them through a combination of calls
with <a href="qabstractxmlnodemodel.html#SimpleAxis-enum">QSimpleXmlNodeModel.SimpleAxis</a>
values. Therefore, the implementation of this function must return
the node, if any, that appears on the <i>axis</i> emanating from
the <i>origin</i>.</p>
<p>If no such node is available, a default constructed <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a> is returned.</p>
<p><a href="qsimplexmlnodemodel.html">QSimpleXmlNodeModel</a>
eliminates the need to handle redundant corner cases by
guaranteeing that it will never ask for:</p>
<ul>
<li>Children or siblings for attributes.</li>
<li>Children for comments, processing instructions, and text
nodes.</li>
<li>Siblings or parents for document nodes.</li>
</ul>
<p>A typical implementation performs a <tt>switch</tt> on the value
of <i>axis</i>:</p>
<pre class="cpp">
 <span class="type"><a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a></span> MyTreeModel<span class="operator">.</span>nextFromSimpleAxis(SimpleAxis axis<span class="operator">,</span> <span class="keyword">const</span> <span class="type"><a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a></span> <span class="operator">&amp;</span>origin) <span class="keyword">const</span>
 {
   <span class="comment">// Convert the QXmlNodeModelIndex to a value that is specific to what we represent.</span>
   <span class="keyword">const</span> MyValue value <span class="operator">=</span> toMyValue(ni);

   <span class="keyword">switch</span>(axis)
   {
       <span class="keyword">case</span> Parent:
           <span class="keyword">return</span> toNodeIndex(value<span class="operator">.</span>parent());
       <span class="keyword">case</span> FirstChild:
       <span class="keyword">case</span> PreviousSibling:
       <span class="keyword">case</span> NextSibling:
           <span class="comment">// and so on</span>
   }
 }
</pre>


<h3 class="fn"><a name="nodesByIdref" />list-of-QXmlNodeModelIndex QAbstractXmlNodeModel.nodesByIdref (<i>self</i>, <a href="qxmlname.html">QXmlName</a>&#160;<i>NCName</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the elements and/or attributes that have an
<tt>IDREF</tt> value equal to <i>idref</i>. <a href="xmlprocessing.html">XQuery</a>'s <tt>idref()</tt> function calls
this function.</p>
<p>The implementor guarantees that the nodes identified by the
returned indexes are elements or attributes.</p>
<p>It is not sufficient for an attribute or element to merely be
called <tt>idref</tt>. It must also be of type <tt>IDREF</tt>.
Elements must be typed as <tt>xs:IDREF</tt> or <tt>xs:IDREFS</tt>,
or, in the case of attributes, as <tt>IDREF</tt> or <tt>IDREFS</tt>
in the schema.</p>
<p>In <i>idref</i>, the <tt>namespace URI</tt> and the
<tt>prefix</tt> are undefined, and the <tt>local name</tt> is the
ID that should be looked up.</p>
<p><b>See also</b> <a href="http://www.w3.org/TR/xpath-functions/#func-idref">XQuery 1.0 and
XPath 2.0 Functions and Operators, 15.5.3 fn:idref</a>.</p>


<h3 class="fn"><a name="root" /><a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a> QAbstractXmlNodeModel.root (<i>self</i>, <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a>&#160;<i>n</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the root node of the tree that contains the node whose
index is <i>n</i>. The caller guarantees that <i>n</i> is not
<tt>null</tt> and that it identifies a node in this node model.</p>
<p>If <i>n</i> identifies a node that is a direct child of the
root, parent() would return the same <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a> returned by this
function.</p>


<h3 class="fn"><a name="sourceLocation" /><a href="qsourcelocation.html">QSourceLocation</a> QAbstractXmlNodeModel.sourceLocation (<i>self</i>, <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a>&#160;<i>index</i>)</h3><p>Returns the source location for the object with the given
<i>index</i> or a default constructed <a href="qsourcelocation.html">QSourceLocation</a> in case no location
information is available.</p>
<p>This function was introduced in Qt 4.6.</p>


<h3 class="fn"><a name="stringValue" />QString QAbstractXmlNodeModel.stringValue (<i>self</i>, <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a>&#160;<i>n</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the string value for node <i>n</i>.</p>
<p>The caller guarantees that <i>n</i> is not <tt>null</tt> and
that it belong to this <a href="qabstractxmlnodemodel.html">QAbstractXmlNodeModel</a>
instance.</p>
<p>This function maps to the <tt>dm:string-value()</tt> accessor,
which the specification completely specifies. Here's a summary:</p>
<ul>
<li>For processing instructions, the string value is the data
section(excluding any whitespace appearing between the name and the
data).</li>
<li>For text nodes, the string value equals the text node.</li>
<li>For comments, the content of the comment</li>
<li>For elements, the concatenation of all text nodes that are
descendants. Note, this is not only the children, but the
childrens' childrens' text nodes, and so forth.</li>
<li>For document nodes, the concatenation of all text nodes in the
document.</li>
</ul>
<p><b>See also</b> <a href="http://www.w3.org/TR/xpath-datamodel/#dm-string-value">XQuery 1.0
and XPath 2.0 Data Model (XDM), 5.13 string-value Accessor</a>.</p>


<h3 class="fn"><a name="typedValue" />QVariant QAbstractXmlNodeModel.typedValue (<i>self</i>, <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a>&#160;<i>n</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the typed value for node <i>node</i>.</p>
<p>The typed value is an atomic value, which an element or
attribute contains.</p>
<p>The caller guarantees that <i>node</i> is either an element or
an attribute. The implementor guarantees that the returned <a href="qvariant.html">QVariant</a> has a value which is supported in
<a href="xmlprocessing.html">XQuery</a>. It cannot be an arbitrary
<a href="qvariant.html">QVariant</a> value. The implementor also
guarantees that <a href="qabstractxmlnodemodel.html#stringValue">stringValue</a>() returns
a lexical representation of typedValue()(this is guaranteed by
<a href="qsimplexmlnodemodel.html#stringValue">QSimpleXmlNodeModel.stringValue</a>()).</p>
<p>If the return <a href="qvariant.html">QVariant</a> is a default
constructed variant, it signals that <i>node</i> has no typed
value.</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>