QDomAttr(3qt)
πΈ QDomAttr β bestie edition πΈ
okay so this is the whole manual page for QDomAttr, from the QDomAttr(3qt) man page, and I am obsessed with how straightforward this one is. No gatekeeping, let's go π
β¨ NAME β¨
QDomAttr β it represents one attribute of a QDomElement. One. Singular. That's the whole job and it does it flawlessly.
β¨ SYNOPSIS β¨
First thing first, the reentrancy tea: all the functions in this class are reentrant when Qt is built with thread support. (Also there's a stray </p> sitting in that sentence in the original. Not me noticing. We move on π«Ά)
#include <qdom.h>
Inherits QDomNode.
π Public Members π
QDomAttr ()QDomAttr ( const QDomAttr & x )QDomAttr & operator= ( const QDomAttr & x )~QDomAttr ()virtual QString name () constvirtual bool specified () constvirtual QDomElement ownerElement () constvirtual QString value () constvirtual void setValue ( const QString & v )virtual QDomNode::NodeType nodeType () constvirtual bool isAttr () const
β¨ DESCRIPTION β¨
So the QDomAttr class represents one attribute of a QDomElement. That's the vibe. That's the whole personality.
For example, the following piece of XML produces an element with no children, but two attributes:
<link href="http://www.trolltech.com" color="red" />
See how that element is childless but still carrying two whole attributes? Main character energy, honestly. You can access the attributes of an element with code like this:
QDomElement e = //...
//...
QDomAttr a = e.attributeNode( "href" );
cout << a.value() << endl; // prints "http://www.trolltech.com"
a.setValue( "http://doc.trolltech.com" ); // change the node's attribute
QDomAttr a2 = e.attributeNode( "href" );
cout << a2.value() << endl; // prints "http://doc.trolltech.com"
This example also shows that changing an attribute received from an element changes the attribute of the element. Lowkey important: if you do not want to change the value of the element's attribute, you must use cloneNode() to get an independent copy of the attribute. Don't skip that part bestie, fr fr.
QDomAttr can return the name() and value() of an attribute. An attribute's value is set with setValue(). If specified() returns TRUE the value was either set in the document or set with setValue(); otherwise the value hasn't been set. The node this attribute is attached to (if any) is returned by ownerElement().
For further information about the Document Object Model see http://www.w3.org/TR/REC-DOM-Level-1/ and http://www.w3.org/TR/DOM-Level-2-Core/. For a more general introduction of the DOM implementation see the QDomDocument documentation.
See also XML.
π MEMBER FUNCTION DOCUMENTATION π
QDomAttr::QDomAttr ()
Constructs an empty attribute. Blank slate, no attributes attached, just vibes and potential β¨
QDomAttr::QDomAttr ( const QDomAttr & x )
Constructs a copy of x.
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 cloneNode(). Yeah, they're linked like that. It's giving soulmates, but for memory π
QDomAttr::~QDomAttr ()
Destroys the object and frees its resources. Rest in peace little attribute π
bool QDomAttr::isAttr () const [virtual]
Returns TRUE.
Reimplemented from QDomNode.
QString QDomAttr::name () const [virtual]
Returns the attribute's name.
QDomNode::NodeType QDomAttr::nodeType () const [virtual]
Returns AttributeNode.
Reimplemented from QDomNode.
QDomAttr & QDomAttr::operator= ( const QDomAttr & x )
Assigns x to this DOM attribute.
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 cloneNode(). Same deal as the copy constructor, no cap.
QDomElement QDomAttr::ownerElement () const [virtual]
Returns the element node this attribute is attached to, or a null node if this attribute is not attached to any element. Single and ready to mingle (null node) vs. taken (QDomElement) β the classic duality π¦
void QDomAttr::setValue ( const QString & v ) [virtual]
Sets the attribute's value to v.
See also value().
bool QDomAttr::specified () const [virtual]
Returns TRUE if the attribute has either been expicitly specified in the XML document or was set by the user with setValue(). Returns FALSE if the value hasn't been specified or set.
(yes, "expicitly" β that's the original spelling, I'm just the messenger π)
See also setValue().
QString QDomAttr::value () const [virtual]
Returns the value of the attribute or QString::null if the attribute has not been specified.
See also specified() and setValue().
π SEE ALSO π
π COPYRIGHT π
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.
β AUTHOR β
Generated automatically from the source code. (So no, a human didn't hand-write this one, it was born this way π«)
π BUGS π
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you.
The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.
If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qdomattr.3qt) and the Qt version (3.3.8).
Okay so to be clear: this format is not officially supported by Trolltech. It's a little gift for the man page girlies. Enjoy responsibly π§
aaaand that's the whole page, bestie, nothing skipped, nothing gatekept π this one came to you from Trolltech AS, dated 2 February 2007, running Qt version 3.3.8, filed under the manual page qdomattr.3qt. go forth and slay your attributes β¨ππ¦
π¦ where this page comes from
- fedora 43: qt3-devel-docs 3.3.8b-102.fc43 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- fedora 44: qt3-devel-docs 3.3.8b-103.fc44 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms