~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/qdomattr.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/xml/qdom.cpp -->
 
6
<head>
 
7
    <title>Qt 4.0: QDomAttr Class Reference</title>
 
8
    <style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
 
9
a:link { color: #004faf; text-decoration: none }
 
10
a:visited { color: #672967; text-decoration: none }
 
11
td.postheader { font-family: sans-serif }
 
12
tr.address { font-family: sans-serif }
 
13
body { background: #ffffff; color: black; }</style>
 
14
</head>
 
15
<body>
 
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
17
<tr>
 
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
 
19
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
 
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QDomAttr Class Reference</h1>
 
21
<p>The QDomAttr class represents one attribute of a <a href="qdomelement.html">QDomElement</a>. <a href="#details">More...</a></p>
 
22
<pre>#include &lt;QDomAttr&gt;</pre><p>Part of the <a href="qtxml.html">QtXml</a> module.</p>
 
23
<p>Inherits <a href="qdomnode.html">QDomNode</a>.</p>
 
24
<p><b>Note:</b> All the functions in this class are <a href="threads.html#reentrant">reentrant</a>.</p>
 
25
<ul>
 
26
<li><a href="qdomattr-members.html">List of all members, including inherited members</a></li>
 
27
</ul>
 
28
<a name="public-functions"></a>
 
29
<h3>Public Functions</h3>
 
30
<ul>
 
31
<li><div class="fn"/><b><a href="qdomattr.html#QDomAttr">QDomAttr</a></b> ()</li>
 
32
<li><div class="fn"/><b><a href="qdomattr.html#QDomAttr-2">QDomAttr</a></b> ( const QDomAttr &amp; <i>x</i> )</li>
 
33
<li><div class="fn"/>QString <b><a href="qdomattr.html#name">name</a></b> () const</li>
 
34
<li><div class="fn"/>QDomNode::NodeType <b><a href="qdomattr.html#nodeType">nodeType</a></b> () const</li>
 
35
<li><div class="fn"/>QDomElement <b><a href="qdomattr.html#ownerElement">ownerElement</a></b> () const</li>
 
36
<li><div class="fn"/>void <b><a href="qdomattr.html#setValue">setValue</a></b> ( const QString &amp; <i>v</i> )</li>
 
37
<li><div class="fn"/>bool <b><a href="qdomattr.html#specified">specified</a></b> () const</li>
 
38
<li><div class="fn"/>QString <b><a href="qdomattr.html#value">value</a></b> () const</li>
 
39
<li><div class="fn"/>QDomAttr &amp; <b><a href="qdomattr.html#operator-eq">operator=</a></b> ( const QDomAttr &amp; <i>x</i> )</li>
 
40
</ul>
 
41
<ul>
 
42
<li><div class="fn"/>63 public functions inherited from <a href="qdomnode.html#public-functions">QDomNode</a></li>
 
43
</ul>
 
44
<a name="details"></a>
 
45
<hr />
 
46
<h2>Detailed Description</h2>
 
47
<p>The QDomAttr class represents one attribute of a <a href="qdomelement.html">QDomElement</a>.</p>
 
48
<p>For example, the following piece of XML produces an element with no children, but two attributes:</p>
 
49
<pre>&nbsp;   &lt;link href=&quot;http://www.trolltech.com&quot; color=&quot;red&quot; /&gt;</pre>
 
50
<p>You can access the attributes of an element with code like this:</p>
 
51
<pre>&nbsp;   QDomElement e = //...
 
52
    //...
 
53
    QDomAttr a = e.attributeNode(&quot;href&quot;);
 
54
    cout &lt;&lt; a.value() &lt;&lt; endl;                // prints &quot;http://www.trolltech.com&quot;
 
55
    a.setValue(&quot;http://doc.trolltech.com&quot;); // change the node's attribute
 
56
    QDomAttr a2 = e.attributeNode(&quot;href&quot;);
 
57
    cout &lt;&lt; a2.value() &lt;&lt; endl;               // prints &quot;http://doc.trolltech.com&quot;</pre>
 
58
<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>
 
59
<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 either set in the document or set with <a href="qdomattr.html#setValue">setValue</a>(); otherwise the value hasn't been set. The node this attribute is attached to (if any) is returned by <a href="qdomattr.html#ownerElement">ownerElement</a>().</p>
 
60
<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>
 
61
<hr />
 
62
<h2>Member Function Documentation</h2>
 
63
<h3 class="fn"><a name="QDomAttr"></a>QDomAttr::QDomAttr ()</h3>
 
64
<p>Constructs an empty attribute.</p>
 
65
<h3 class="fn"><a name="QDomAttr-2"></a>QDomAttr::QDomAttr ( const QDomAttr &amp; <i>x</i> )</h3>
 
66
<p>Constructs a copy of <i>x</i>.</p>
 
67
<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>
 
68
<h3 class="fn"><a name="name"></a><a href="qstring.html">QString</a> QDomAttr::name () const</h3>
 
69
<p>Returns the attribute's name.</p>
 
70
<h3 class="fn"><a name="nodeType"></a><a href="qdomnode.html#NodeType-enum">QDomNode::NodeType</a> QDomAttr::nodeType () const</h3>
 
71
<p>Returns <a href="qdomnode.html#NodeType-enum">AttributeNode</a>.</p>
 
72
<h3 class="fn"><a name="ownerElement"></a><a href="qdomelement.html">QDomElement</a> QDomAttr::ownerElement () const</h3>
 
73
<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>
 
74
<h3 class="fn"><a name="setValue"></a>void QDomAttr::setValue ( const <a href="qstring.html">QString</a> &amp; <i>v</i> )</h3>
 
75
<p>Sets the attribute's value to <i>v</i>.</p>
 
76
<p>See also <a href="qdomattr.html#value">value</a>().</p>
 
77
<h3 class="fn"><a name="specified"></a>bool QDomAttr::specified () const</h3>
 
78
<p>Returns true if the attribute has either been expicitly specified in the XML document or was set by the user with <a href="qdomattr.html#setValue">setValue</a>(). Returns false if the value hasn't been specified or set.</p>
 
79
<p>See also <a href="qdomattr.html#setValue">setValue</a>().</p>
 
80
<h3 class="fn"><a name="value"></a><a href="qstring.html">QString</a> QDomAttr::value () const</h3>
 
81
<p>Returns the value of the attribute or an empty string if the attribute has not been specified.</p>
 
82
<p>See also <a href="qdomattr.html#specified">specified</a>() and <a href="qdomattr.html#setValue">setValue</a>().</p>
 
83
<h3 class="fn"><a name="operator-eq"></a>QDomAttr &amp; QDomAttr::operator= ( const QDomAttr &amp; <i>x</i> )</h3>
 
84
<p>Assigns <i>x</i> to this DOM attribute.</p>
 
85
<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>
 
86
<p /><address><hr /><div align="center">
 
87
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
88
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
89
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
90
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
91
</tr></table></div></address></body>
 
92
</html>