<?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>QXmlNodeModelIndex 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">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QXmlNodeModelIndex Class Reference<br /><sup><sup>[<a href="qtxmlpatterns.html">QtXmlPatterns</a> module]</sup></sup></h1><p>The QXmlNodeModelIndex class identifies a node in an XML node model subclassed from <a href="qabstractxmlnodemodel.html">QAbstractXmlNodeModel</a>. <a href="#details">More...</a></p> <h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qxmlnodemodelindex.html#DocumentOrder-enum">DocumentOrder</a></b> { Precedes, Is, Follows }</li><li><div class="fn" />enum <b><a href="qxmlnodemodelindex.html#NodeKind-enum">NodeKind</a></b> { Attribute, Comment, Document, Element, ..., Text }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qxmlnodemodelindex.html#QXmlNodeModelIndex">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qxmlnodemodelindex.html#QXmlNodeModelIndex-2">__init__</a></b> (<i>self</i>, QXmlNodeModelIndex <i>other</i>)</li><li><div class="fn" />int <b><a href="qxmlnodemodelindex.html#additionalData">additionalData</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qxmlnodemodelindex.html#data">data</a></b> (<i>self</i>)</li><li><div class="fn" />object <b><a href="qxmlnodemodelindex.html#internalPointer">internalPointer</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qxmlnodemodelindex.html#isNull">isNull</a></b> (<i>self</i>)</li><li><div class="fn" />QAbstractXmlNodeModel <b><a href="qxmlnodemodelindex.html#model">model</a></b> (<i>self</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="qxmlnodemodelindex.html#__eq__">__eq__</a></b> (<i>self</i>, QXmlNodeModelIndex <i>other</i>)</li><li><div class="fn" />int <b><a href="qxmlnodemodelindex.html#__hash__">__hash__</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qxmlnodemodelindex.html#__ne__">__ne__</a></b> (<i>self</i>, QXmlNodeModelIndex <i>other</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QXmlNodeModelIndex class identifies a node in an XML node model subclassed from <a href="qabstractxmlnodemodel.html">QAbstractXmlNodeModel</a>.</p> <p>QXmlNodeModelIndex is an index into an <a href="qabstractxmlnodemodel.html">XML node model</a>. It contains:</p> <ul> <li>A pointer to an <a href="qabstractxmlnodemodel.html">XML node model</a>, which is returned by <a href="qxmlnodemodelindex.html#model">model</a>(), and</li> <li>Some data, which is returned by <a href="qxmlnodemodelindex.html#data">data</a>(), <a href="qxmlnodemodelindex.html#internalPointer">internalPointer</a>(), and <a href="qxmlnodemodelindex.html#additionalData">additionalData</a>().</li> </ul> <p>Because QXmlNodeModelIndex is intentionally a simple class, it doesn't have member functions for accessing the properties of nodes. For example, it doesn't have functions for getting a node's name or its list of attributes or child nodes. If you find that you need to retrieve this kind of information from your query results, there are two ways to proceed.</p> <ul> <li>Send the output of your <a href="xmlprocessing.html">XQuery</a> to an <a href="qabstractxmlreceiver.html">XML receiver</a>, or</li> <li>Let your <a href="xmlprocessing.html">XQuery</a> do all the work to produce the desired result.</li> </ul> <p>The second case is explained by example. Suppose you want to populate a list widget with the values of certain attributes from a set of result elements. You could write an <a href="xmlprocessing.html">XQuery</a> to return the set of elements, and then you would write the code to iterate over the result elements, get their attributes, and extract the desired string values. But the simpler way is to just augment your <a href="xmlprocessing.html">XQuery</a> to finding the desired attribute values. Then all you have to do is evaluate the <a href="xmlprocessing.html">XQuery</a> using the version of <a href="qxmlquery.html#evaluateTo">QXmlQuery.evaluateTo</a>() that populates a <a href="qstringlist.html">QStringList</a>, which you can send directly to your widget.</p> <p>QXmlNodeModelIndex doesn't impose any restrictions on the <tt>data</tt> value an QXmlNodeModelIndex should contain. The meaning of the data left to the associated <a href="qabstractxmlnodemodel.html">node model</a>. Because QXmlNodeModelIndex depends on a particular subclass of <a href="qabstractxmlnodemodel.html">QAbstractXmlNodeModel</a> for its existence, the only way you can create an instance of QXmlNodeModelIndex is by asking the node model to create one for you with <a href="qabstractxmlnodemodel.html#createIndex">QAbstractXmlNodeModel.createIndex</a>(). Since that function is protected, it is usually a good idea to write a public function that creates a QXmlNodeModelIndex from arguments that are appropriate for your particular node model.</p> <p>A default constructed node index is said to be null, i.e., <a href="qxmlnodemodelindex.html#isNull">isNull</a>() returns true.</p> <p>QXmlNodeModelIndex and <a href="qabstractxmlnodemodel.html">QAbstractXmlNodeModel</a> follow the same design pattern used for <a href="qmodelindex.html">QModelIndex</a> and <a href="qabstractitemmodel.html">QAbstractItemModel</a>.</p> <hr /><h2>Type Documentation</h2><h3 class="fn"><a name="DocumentOrder-enum" />QXmlNodeModelIndex.DocumentOrder</h3><p>Identifies the specific node comparison operator that should be used.</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>QXmlNodeModelIndex.Precedes</tt></td> <td class="topAlign"><tt>-1</tt></td> <td class="topAlign">Signifies the <tt>\<\<</tt> operator. Test whether the first operand precedes the second in the document.</td> </tr> <tr> <td class="topAlign"><tt>QXmlNodeModelIndex.Follows</tt></td> <td class="topAlign"><tt>1</tt></td> <td class="topAlign">Signifies the <tt>\>\></tt> operator. Test whether the first operand follows the second in the document.</td> </tr> <tr> <td class="topAlign"><tt>QXmlNodeModelIndex.Is</tt></td> <td class="topAlign"><tt>0</tt></td> <td class="topAlign">Signifies the <tt>is</tt> operator. Test whether two nodes have the same node identity.</td> </tr> </table> <h3 class="fn"><a name="NodeKind-enum" />QXmlNodeModelIndex.NodeKind</h3><p>Identifies a kind of node.</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>QXmlNodeModelIndex.Attribute</tt></td> <td class="topAlign"><tt>1</tt></td> <td class="topAlign">Identifies an attribute node</td> </tr> <tr> <td class="topAlign"><tt>QXmlNodeModelIndex.Text</tt></td> <td class="topAlign"><tt>64</tt></td> <td class="topAlign">Identifies a text node</td> </tr> <tr> <td class="topAlign"><tt>QXmlNodeModelIndex.Comment</tt></td> <td class="topAlign"><tt>2</tt></td> <td class="topAlign">Identifies a comment node</td> </tr> <tr> <td class="topAlign"><tt>QXmlNodeModelIndex.Document</tt></td> <td class="topAlign"><tt>4</tt></td> <td class="topAlign">Identifies a document node</td> </tr> <tr> <td class="topAlign"><tt>QXmlNodeModelIndex.Element</tt></td> <td class="topAlign"><tt>8</tt></td> <td class="topAlign">Identifies an element node</td> </tr> <tr> <td class="topAlign"><tt>QXmlNodeModelIndex.Namespace</tt></td> <td class="topAlign"><tt>16</tt></td> <td class="topAlign">Identifies a namespace node</td> </tr> <tr> <td class="topAlign"> <tt>QXmlNodeModelIndex.ProcessingInstruction</tt></td> <td class="topAlign"><tt>32</tt></td> <td class="topAlign">Identifies a processing instruction.</td> </tr> </table> <p>Note that the optional XML declaration at very beginning of the XML document is not a processing instruction</p> <p><b>See also</b> <a href="qabstractxmlnodemodel.html#kind">QAbstractXmlNodeModel.kind</a>().</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QXmlNodeModelIndex" />QXmlNodeModelIndex.__init__ (<i>self</i>)</h3><p>Default constructor. Creates an item that is <tt>null</tt>.</p> <p><b>See also</b> <a href="qxmlnodemodelindex.html#isNull">isNull</a>().</p> <h3 class="fn"><a name="QXmlNodeModelIndex-2" />QXmlNodeModelIndex.__init__ (<i>self</i>, <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a> <i>other</i>)</h3><p>Standard copy constructor. Creates a <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a> instance that is a copy of <i>other</i>.</p> <h3 class="fn"><a name="additionalData" />int QXmlNodeModelIndex.additionalData (<i>self</i>)</h3><p>Returns the second data value. The node index holds two data values. <a href="qxmlnodemodelindex.html#data">data</a>() returns the first one.</p> <p><b>See also</b> <a href="qxmlnodemodelindex.html#data">data</a>().</p> <h3 class="fn"><a name="data" />int QXmlNodeModelIndex.data (<i>self</i>)</h3><p>Returns the first data value. The node index holds two data values. <a href="qxmlnodemodelindex.html#additionalData">additionalData</a>() returns the second one.</p> <p><b>See also</b> <a href="qxmlnodemodelindex.html#additionalData">additionalData</a>().</p> <h3 class="fn"><a name="internalPointer" />object QXmlNodeModelIndex.internalPointer (<i>self</i>)</h3><p>Returns the first data value as a void* pointer.</p> <p><b>See also</b> <a href="qxmlnodemodelindex.html#additionalData">additionalData</a>().</p> <h3 class="fn"><a name="isNull" />bool QXmlNodeModelIndex.isNull (<i>self</i>)</h3><p>Returns true if this <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a> is a default constructed value, otherwise false.</p> <p>A null <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a> doesn't represent any node and cannot be used in conjunction with <a href="qabstractxmlnodemodel.html">QAbstractXmlNodeModel</a>.</p> <h3 class="fn"><a name="model" /><a href="qabstractxmlnodemodel.html">QAbstractXmlNodeModel</a> QXmlNodeModelIndex.model (<i>self</i>)</h3><p>Returns the <a href="qabstractxmlnodemodel.html">QAbstractXmlNodeModel</a> that this node index refers to. <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a> does not own <a href="qabstractxmlnodemodel.html">QAbstractXmlNodeModel</a> and does not keep track of its lifetime, so this pointer will dangle if the <a href="qabstractxmlnodemodel.html">QAbstractXmlNodeModel</a> is deallocated first.</p> <p>There is no setter for the node model because instances of <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a> instances are only created with <a href="qabstractxmlnodemodel.html#createIndex">QAbstractXmlNodeModel.createIndex</a>().</p> <h3 class="fn"><a name="__eq__" />bool QXmlNodeModelIndex.__eq__ (<i>self</i>, <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a> <i>other</i>)</h3><h3 class="fn"><a name="__hash__" />int QXmlNodeModelIndex.__hash__ (<i>self</i>)</h3><h3 class="fn"><a name="__ne__" />bool QXmlNodeModelIndex.__ne__ (<i>self</i>, <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a> <i>other</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>