1QDomAttr(3qt) QDomAttr(3qt)
2
3
4
6 QDomAttr - Represents one attribute of a QDomElement
7
9 All the functions in this class are reentrant when Qt is built with
10 thread support.</p>
11
12 #include <qdom.h>
13
14 Inherits QDomNode.
15
16 Public Members
17 QDomAttr ()
18 QDomAttr ( const QDomAttr & x )
19 QDomAttr & operator= ( const QDomAttr & x )
20 ~QDomAttr ()
21 virtual QString name () const
22 virtual bool specified () const
23 virtual QDomElement ownerElement () const
24 virtual QString value () const
25 virtual void setValue ( const QString & v )
26 virtual QDomNode::NodeType nodeType () const
27 virtual bool isAttr () const
28
30 The QDomAttr class represents one attribute of a QDomElement.
31
32 For example, the following piece of XML produces an element with no
33 children, but two attributes:
34
35 <link href="http://www.trolltech.com" color="red" />
36
37 You can access the attributes of an element with code like this:
38
39 QDomElement e = //...
40 //...
41 QDomAttr a = e.attributeNode( "href" );
42 cout << a.value() << endl; // prints "http://www.trolltech.com"
43 a.setValue( "http://doc.trolltech.com" ); // change the node's attribute
44 QDomAttr a2 = e.attributeNode( "href" );
45 cout << a2.value() << endl; // prints "http://doc.trolltech.com"
46
47 This example also shows that changing an attribute received from an
48 element changes the attribute of the element. If you do not want to
49 change the value of the element's attribute you must use cloneNode() to
50 get an independent copy of the attribute.
51
52 QDomAttr can return the name() and value() of an attribute. An
53 attribute's value is set with setValue(). If specified() returns TRUE
54 the value was either set in the document or set with setValue();
55 otherwise the value hasn't been set. The node this attribute is
56 attached to (if any) is returned by ownerElement().
57
58 For further information about the Document Object Model see
59 http://www.w3.org/TR/REC-DOM-Level-1/ and http://www.w3.org/TR/DOM-
60 Level-2-Core/. For a more general introduction of the DOM
61 implementation see the QDomDocument documentation.
62
63 See also XML.
64
67 Constructs an empty attribute.
68
70 Constructs a copy of x.
71
72 The data of the copy is shared (shallow copy): modifying one node will
73 also change the other. If you want to make a deep copy, use
74 cloneNode().
75
77 Destroys the object and frees its resources.
78
80 Returns TRUE.
81
82 Reimplemented from QDomNode.
83
85 Returns the attribute's name.
86
88 Returns AttributeNode.
89
90 Reimplemented from QDomNode.
91
93 Assigns x to this DOM attribute.
94
95 The data of the copy is shared (shallow copy): modifying one node will
96 also change the other. If you want to make a deep copy, use
97 cloneNode().
98
100 Returns the element node this attribute is attached to or a null node
101 if this attribute is not attached to any element.
102
104 Sets the attribute's value to v.
105
106 See also value().
107
109 Returns TRUE if the attribute has either been expicitly specified in
110 the XML document or was set by the user with setValue(). Returns FALSE
111 if the value hasn't been specified or set.
112
113 See also setValue().
114
116 Returns the value of the attribute or QString::null if the attribute
117 has not been specified.
118
119 See also specified() and setValue().
120
121
123 http://doc.trolltech.com/qdomattr.html
124 http://www.trolltech.com/faq/tech.html
125
127 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
128 license file included in the distribution for a complete license
129 statement.
130
132 Generated automatically from the source code.
133
135 If you find a bug in Qt, please report it as described in
136 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
137 help you. Thank you.
138
139 The definitive Qt documentation is provided in HTML format; it is
140 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
141 web browser. This man page is provided as a convenience for those users
142 who prefer man pages, although this format is not officially supported
143 by Trolltech.
144
145 If you find errors in this manual page, please report them to qt-
146 bugs@trolltech.com. Please include the name of the manual page
147 (qdomattr.3qt) and the Qt version (3.3.8).
148
149
150
151Trolltech AS 2 February 2007 QDomAttr(3qt)