Sophie

Sophie

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

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>QDomAttr 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">QDomAttr Class Reference<br /><sup><sup>[<a href="qtxml.html">QtXml</a> module]</sup></sup></h1><p>The QDomAttr class represents one attribute of a <a href="qdomelement.html">QDomElement</a>. <a href="#details">More...</a></p>

<p>Inherits <a href="qdomnode.html">QDomNode</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qdomattr.html#QDomAttr">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qdomattr.html#QDomAttr-2">__init__</a></b> (<i>self</i>, QDomAttr&#160;<i>x</i>)</li><li><div class="fn" />QString <b><a href="qdomattr.html#name">name</a></b> (<i>self</i>)</li><li><div class="fn" />QDomNode.NodeType <b><a href="qdomattr.html#nodeType">nodeType</a></b> (<i>self</i>)</li><li><div class="fn" />QDomElement <b><a href="qdomattr.html#ownerElement">ownerElement</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qdomattr.html#setValue">setValue</a></b> (<i>self</i>, QString)</li><li><div class="fn" />bool <b><a href="qdomattr.html#specified">specified</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdomattr.html#value">value</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QDomAttr class represents one attribute of a <a href="qdomelement.html">QDomElement</a>.</p>
<p>For example, the following piece of XML produces an element with
no children, but two attributes:</p>
<pre class="cpp">
 <span class="operator">&lt;</span>link href<span class="operator">=</span><span class="string">"http://qt.nokia.com"</span> color<span class="operator">=</span><span class="string">"red"</span> <span class="operator">/</span><span class="operator">&gt;</span>
</pre>
<p>You can access the attributes of an element with code like
this:</p>
<pre class="cpp">
 <span class="type"><a href="qdomelement.html">QDomElement</a></span> e <span class="operator">=</span> <span class="comment">//...</span>
 <span class="comment">//...</span>
 <span class="type">QDomAttr</span> a <span class="operator">=</span> e<span class="operator">.</span>attributeNode(<span class="string">"href"</span>);
 cout <span class="operator">&lt;</span><span class="operator">&lt;</span> a<span class="operator">.</span><a href="qdomattr.html#value">value</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> endl;                <span class="comment">// prints "http://qt.nokia.com"</span>
 a<span class="operator">.</span><a href="qdomattr.html#setValue">setValue</a>(<span class="string">"http://qt.nokia.com/doc"</span>); <span class="comment">// change the node's attribute</span>
 <span class="type">QDomAttr</span> a2 <span class="operator">=</span> e<span class="operator">.</span>attributeNode(<span class="string">"href"</span>);
 cout <span class="operator">&lt;</span><span class="operator">&lt;</span> a2<span class="operator">.</span><a href="qdomattr.html#value">value</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> endl;               <span class="comment">// prints "http://qt.nokia.com/doc"</span>
</pre>
<p>This example also shows that changing an attribute received from
an element changes the attribute of the element. If you do not want
to change the value of the element's attribute you must use
<a href="qdomnode.html#cloneNode">cloneNode</a>() to get an
independent copy of the attribute.</p>
<p>QDomAttr can return the <a href="qdomattr.html#name">name</a>()
and <a href="qdomattr.html#value">value</a>() of an attribute. An
attribute's value is set with <a href="qdomattr.html#setValue">setValue</a>(). If <a href="qdomattr.html#specified">specified</a>() returns true the value
was set with <a href="qdomattr.html#setValue">setValue</a>(). The
node this attribute is attached to (if any) is returned by <a href="qdomattr.html#ownerElement">ownerElement</a>().</p>
<p>For further information about the Document Object Model see
<a href="http://www.w3.org/TR/REC-DOM-Level-1/">http://www.w3.org/TR/REC-DOM-Level-1/</a>
and <a href="http://www.w3.org/TR/DOM-Level-2-Core/">http://www.w3.org/TR/DOM-Level-2-Core/</a>.
For a more general introduction of the DOM implementation see the
<a href="qdomdocument.html">QDomDocument</a> documentation.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QDomAttr" />QDomAttr.__init__ (<i>self</i>)</h3><p>Constructs an empty attribute.</p>


<h3 class="fn"><a name="QDomAttr-2" />QDomAttr.__init__ (<i>self</i>, <a href="qdomattr.html">QDomAttr</a>&#160;<i>x</i>)</h3><p>Constructs a copy of <i>x</i>.</p>
<p>The data of the copy is shared (shallow copy): modifying one
node will also change the other. If you want to make a deep copy,
use <a href="qdomnode.html#cloneNode">cloneNode</a>().</p>


<h3 class="fn"><a name="name" />QString QDomAttr.name (<i>self</i>)</h3><p>Returns the attribute's name.</p>


<h3 class="fn"><a name="nodeType" /><a href="qdomnode.html#NodeType-enum">QDomNode.NodeType</a> QDomAttr.nodeType (<i>self</i>)</h3><p>Returns <a href="qdomnode.html#NodeType-enum">AttributeNode</a>.</p>


<h3 class="fn"><a name="ownerElement" /><a href="qdomelement.html">QDomElement</a> QDomAttr.ownerElement (<i>self</i>)</h3><p>Returns the element node this attribute is attached to or a
<a href="qdomnode.html#isNull">null node</a> if this attribute is
not attached to any element.</p>


<h3 class="fn"><a name="setValue" />QDomAttr.setValue (<i>self</i>, QString)</h3><p>Sets the attribute's value to <i>v</i>.</p>
<p><b>See also</b> <a href="qdomattr.html#value">value</a>().</p>


<h3 class="fn"><a name="specified" />bool QDomAttr.specified (<i>self</i>)</h3><p>Returns true if the attribute has been set by the user with
<a href="qdomattr.html#setValue">setValue</a>(). Returns false if
the value hasn't been specified or set.</p>
<p><b>See also</b> <a href="qdomattr.html#setValue">setValue</a>().</p>


<h3 class="fn"><a name="value" />QString QDomAttr.value (<i>self</i>)</h3><p>Returns the value of the attribute or an empty string if the
attribute has not been specified.</p>
<p><b>See also</b> <a href="qdomattr.html#specified">specified</a>() and <a href="qdomattr.html#setValue">setValue</a>().</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>