Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QDomElement Class Reference

\reentrant More...

#include <qdom.h>

+ Inheritance diagram for QDomElement:
+ Collaboration diagram for QDomElement:

Public Member Functions

 QDomElement ()
 Constructs an empty element.
 
 QDomElement (const QDomElement &element)
 Constructs a copy of element.
 
QDomElementoperator= (const QDomElement &other)
 Assigns other to this DOM element.
 
QString attribute (const QString &name, const QString &defValue=QString()) const
 Returns the attribute called name.
 
void setAttribute (const QString &name, const QString &value)
 Adds an attribute called name with value value.
 
void setAttribute (const QString &name, qlonglong value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The formatting always uses QLocale::C.
 
void setAttribute (const QString &name, qulonglong value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The formatting always uses QLocale::C.
 
void setAttribute (const QString &name, int value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The formatting always uses QLocale::C.
 
void setAttribute (const QString &name, uint value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The formatting always uses QLocale::C.
 
void setAttribute (const QString &name, float value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The formatting always uses QLocale::C.
 
void setAttribute (const QString &name, double value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The formatting always uses QLocale::C.
 
void removeAttribute (const QString &name)
 Removes the attribute called name name from this element.
 
QDomAttr attributeNode (const QString &name)
 Returns the QDomAttr object that corresponds to the attribute called name.
 
QDomAttr setAttributeNode (const QDomAttr &newAttr)
 Adds the attribute newAttr to this element.
 
QDomAttr removeAttributeNode (const QDomAttr &oldAttr)
 Removes the attribute oldAttr from the element and returns it.
 
QDomNodeList elementsByTagName (const QString &tagname) const
 Returns a QDomNodeList containing all descendants of this element named tagname encountered during a preorder traversal of the element subtree with this element as its root.
 
bool hasAttribute (const QString &name) const
 Returns true if this element has an attribute called name; otherwise returns false.
 
QString attributeNS (const QString &nsURI, const QString &localName, const QString &defValue=QString()) const
 Returns the attribute with the local name localName and the namespace URI nsURI.
 
void setAttributeNS (const QString &nsURI, const QString &qName, const QString &value)
 Adds an attribute with the qualified name qName and the namespace URI nsURI with the value value.
 
void setAttributeNS (const QString &nsURI, const QString &qName, int value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void setAttributeNS (const QString &nsURI, const QString &qName, uint value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void setAttributeNS (const QString &nsURI, const QString &qName, qlonglong value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void setAttributeNS (const QString &nsURI, const QString &qName, qulonglong value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void setAttributeNS (const QString &nsURI, const QString &qName, double value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void removeAttributeNS (const QString &nsURI, const QString &localName)
 Removes the attribute with the local name localName and the namespace URI nsURI from this element.
 
QDomAttr attributeNodeNS (const QString &nsURI, const QString &localName)
 Returns the QDomAttr object that corresponds to the attribute with the local name localName and the namespace URI nsURI.
 
QDomAttr setAttributeNodeNS (const QDomAttr &newAttr)
 Adds the attribute newAttr to this element.
 
QDomNodeList elementsByTagNameNS (const QString &nsURI, const QString &localName) const
 Returns a QDomNodeList containing all descendants of this element with local name localName and namespace URI nsURI encountered during a preorder traversal of the element subtree with this element as its root.
 
bool hasAttributeNS (const QString &nsURI, const QString &localName) const
 Returns true if this element has an attribute with the local name localName and the namespace URI nsURI; otherwise returns false.
 
QString tagName () const
 Returns the tag name of this element.
 
void setTagName (const QString &name)
 Sets this element's tag name to name.
 
QDomNamedNodeMap attributes () const
 Returns a QDomNamedNodeMap containing all this element's attributes.
 
QDomNode::NodeType nodeType () const
 Returns ElementNode.
 
QString text () const
 Returns the element's text or an empty string.
 
- Public Member Functions inherited from QDomNode
 QDomNode ()
 Constructs a \l{isNull()}{null} node.
 
 QDomNode (const QDomNode &node)
 Constructs a copy of node.
 
QDomNodeoperator= (const QDomNode &other)
 Assigns a copy of other to this DOM node.
 
bool operator== (const QDomNode &other) const
 Returns true if other and this DOM node are equal; otherwise returns false.
 
bool operator!= (const QDomNode &other) const
 Returns true if other and this DOM node are not equal; otherwise returns false.
 
 ~QDomNode ()
 Destroys the object and frees its resources.
 
QDomNode insertBefore (const QDomNode &newChild, const QDomNode &refChild)
 Inserts the node newChild before the child node refChild.
 
QDomNode insertAfter (const QDomNode &newChild, const QDomNode &refChild)
 Inserts the node newChild after the child node refChild.
 
QDomNode replaceChild (const QDomNode &newChild, const QDomNode &oldChild)
 Replaces oldChild with newChild.
 
QDomNode removeChild (const QDomNode &oldChild)
 Removes oldChild from the list of children.
 
QDomNode appendChild (const QDomNode &newChild)
 Appends newChild as the node's last child.
 
bool hasChildNodes () const
 Returns true if the node has one or more children; otherwise returns false.
 
QDomNode cloneNode (bool deep=true) const
 Creates a deep (not shallow) copy of the QDomNode.
 
void normalize ()
 Calling normalize() on an element converts all its children into a standard form.
 
bool isSupported (const QString &feature, const QString &version) const
 Returns true if the DOM implementation implements the feature feature and this feature is supported by this node in the version version; otherwise returns false.
 
QString nodeName () const
 Returns the name of the node.
 
NodeType nodeType () const
 Returns the type of the node.
 
QDomNode parentNode () const
 Returns the parent node.
 
QDomNodeList childNodes () const
 Returns a list of all direct child nodes.
 
QDomNode firstChild () const
 Returns the first child of the node.
 
QDomNode lastChild () const
 Returns the last child of the node.
 
QDomNode previousSibling () const
 Returns the previous sibling in the document tree.
 
QDomNode nextSibling () const
 Returns the next sibling in the document tree.
 
QDomNamedNodeMap attributes () const
 Returns a named node map of all attributes.
 
QDomDocument ownerDocument () const
 Returns the document to which this node belongs.
 
QString namespaceURI () const
 Returns the namespace URI of this node or an empty string if the node has no namespace URI.
 
QString localName () const
 If the node uses namespaces, this function returns the local name of the node; otherwise it returns an empty string.
 
bool hasAttributes () const
 Returns true if the node has attributes; otherwise returns false.
 
QString nodeValue () const
 Returns the value of the node.
 
void setNodeValue (const QString &value)
 Sets the node's value to value.
 
QString prefix () const
 Returns the namespace prefix of the node or an empty string if the node has no namespace prefix.
 
void setPrefix (const QString &pre)
 If the node has a namespace prefix, this function changes the namespace prefix of the node to pre.
 
bool isAttr () const
 Returns true if the node is an attribute; otherwise returns false.
 
bool isCDATASection () const
 Returns true if the node is a CDATA section; otherwise returns false.
 
bool isDocumentFragment () const
 Returns true if the node is a document fragment; otherwise returns false.
 
bool isDocument () const
 Returns true if the node is a document; otherwise returns false.
 
bool isDocumentType () const
 Returns true if the node is a document type; otherwise returns false.
 
bool isElement () const
 Returns true if the node is an element; otherwise returns false.
 
bool isEntityReference () const
 Returns true if the node is an entity reference; otherwise returns false.
 
bool isText () const
 Returns true if the node is a text node; otherwise returns false.
 
bool isEntity () const
 Returns true if the node is an entity; otherwise returns false.
 
bool isNotation () const
 Returns true if the node is a notation; otherwise returns false.
 
bool isProcessingInstruction () const
 Returns true if the node is a processing instruction; otherwise returns false.
 
bool isCharacterData () const
 Returns true if the node is a character data node; otherwise returns false.
 
bool isComment () const
 Returns true if the node is a comment; otherwise returns false.
 
QDomNode namedItem (const QString &name) const
 Returns the first direct child node for which nodeName() equals name.
 
bool isNull () const
 Returns true if this node is null (i.e.
 
void clear ()
 Converts the node into a null node; if it was not a null node before, its type and contents are deleted.
 
QDomAttr toAttr () const
 Converts a QDomNode into a QDomAttr.
 
QDomCDATASection toCDATASection () const
 Converts a QDomNode into a QDomCDATASection.
 
QDomDocumentFragment toDocumentFragment () const
 Converts a QDomNode into a QDomDocumentFragment.
 
QDomDocument toDocument () const
 Converts a QDomNode into a QDomDocument.
 
QDomDocumentType toDocumentType () const
 Converts a QDomNode into a QDomDocumentType.
 
QDomElement toElement () const
 Converts a QDomNode into a QDomElement.
 
QDomEntityReference toEntityReference () const
 Converts a QDomNode into a QDomEntityReference.
 
QDomText toText () const
 Converts a QDomNode into a QDomText.
 
QDomEntity toEntity () const
 Converts a QDomNode into a QDomEntity.
 
QDomNotation toNotation () const
 Converts a QDomNode into a QDomNotation.
 
QDomProcessingInstruction toProcessingInstruction () const
 Converts a QDomNode into a QDomProcessingInstruction.
 
QDomCharacterData toCharacterData () const
 Converts a QDomNode into a QDomCharacterData.
 
QDomComment toComment () const
 Converts a QDomNode into a QDomComment.
 
void save (QTextStream &, int, EncodingPolicy=QDomNode::EncodingFromDocument) const
 Writes the XML representation of the node and all its children to the stream stream.
 
QDomElement firstChildElement (const QString &tagName=QString(), const QString &namespaceURI=QString()) const
 Returns the first child element with tag name tagName and namespace URI namespaceURI.
 
QDomElement lastChildElement (const QString &tagName=QString(), const QString &namespaceURI=QString()) const
 Returns the last child element with tag name tagName and namespace URI namespaceURI.
 
QDomElement previousSiblingElement (const QString &tagName=QString(), const QString &namespaceURI=QString()) const
 Returns the previous sibling element with tag name tagName and namespace URI namespaceURI.
 
QDomElement nextSiblingElement (const QString &taName=QString(), const QString &namespaceURI=QString()) const
 Returns the next sibling element with tag name tagName and namespace URI namespaceURI.
 
int lineNumber () const
 
int columnNumber () const
 

Friends

class QDomDocument
 
class QDomNode
 
class QDomAttr
 

Additional Inherited Members

- Public Types inherited from QDomNode
enum  NodeType {
  ElementNode = 1 , AttributeNode = 2 , TextNode = 3 , CDATASectionNode = 4 ,
  EntityReferenceNode = 5 , EntityNode = 6 , ProcessingInstructionNode = 7 , CommentNode = 8 ,
  DocumentNode = 9 , DocumentTypeNode = 10 , DocumentFragmentNode = 11 , NotationNode = 12 ,
  BaseNode = 21 , CharacterDataNode = 22
}
 This enum defines the type of the node: \value ElementNode \value AttributeNode \value TextNode \value CDATASectionNode \value EntityReferenceNode \value EntityNode \value ProcessingInstructionNode \value CommentNode \value DocumentNode \value DocumentTypeNode \value DocumentFragmentNode \value NotationNode \value BaseNode A QDomNode object, i.e. More...
 
enum  EncodingPolicy { EncodingFromDocument = 1 , EncodingFromTextStream = 2 }
 
- Protected Member Functions inherited from QDomNode
 QDomNode (QDomNodePrivate *)
 
- Protected Attributes inherited from QDomNode
QDomNodePrivateimpl
 

Detailed Description

\reentrant

The QDomElement class represents one element in the DOM tree.

\inmodule QtXml

Elements have a tagName() and zero or more attributes associated with them. The tag name can be changed with setTagName().

Element attributes are represented by QDomAttr objects that can be queried using the attribute() and attributeNode() functions. You can set attributes with the setAttribute() and setAttributeNode() functions. Attributes can be removed with removeAttribute(). There are namespace-aware equivalents to these functions, i.e. setAttributeNS(), setAttributeNodeNS() and removeAttributeNS().

If you want to access the text of a node use text(), e.g.

QDomElement e = //...
//...
QString s = e.text()

The text() function operates recursively to find the text (since not all elements contain text). If you want to find all the text in all of a node's children, iterate over the children looking for QDomText nodes, e.g.

QDomElement element = doc.documentElement();
for(QDomNode n = element.firstChild(); !n.isNull(); n = n.nextSibling())
{
if (!t.isNull())
text += t.data();
}

Note that we attempt to convert each node to a text node and use text() rather than using firstChild().toText().data() or n.toText().data() directly on the node, because the node may not be a text element.

You can get a list of all the descendents of an element which have a specified tag name with elementsByTagName() or elementsByTagNameNS().

To browse the elements of a dom document use firstChildElement(), lastChildElement(), nextSiblingElement() and previousSiblingElement(). For example, to iterate over all child elements called "entry" in a root element called "database", you can use:

QDomDocument doc = // ...
QDomElement root = doc.firstChildElement("database");
QDomElement elt = root.firstChildElement("entry");
for (; !elt.isNull(); elt = elt.nextSiblingElement("entry")) {
// ...
}

For further information about the Document Object Model see \l{W3C DOM Level 1}{Level 1} and \l{W3C DOM Level 2}{Level 2 Core}. For a more general introduction of the DOM implementation see the QDomDocument documentation.

Definition at line 470 of file qdom.h.

Constructor & Destructor Documentation

◆ QDomElement() [1/2]

QDomElement::QDomElement ( )

Constructs an empty element.

Use the QDomDocument::createElement() function to construct elements with content.

Definition at line 4197 of file qdom.cpp.

◆ QDomElement() [2/2]

QDomElement::QDomElement ( const QDomElement & element)

Constructs a copy of element.

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().

Definition at line 4209 of file qdom.cpp.

Member Function Documentation

◆ attribute()

QString QDomElement::attribute ( const QString & name,
const QString & defValue = QString() ) const

Returns the attribute called name.

If the attribute does not exist defValue is returned.

See also
setAttribute(), attributeNode(), setAttributeNode(), attributeNS()

Definition at line 4280 of file qdom.cpp.

References IMPL, and QDomNode::impl.

◆ attributeNode()

QDomAttr QDomElement::attributeNode ( const QString & name)

Returns the QDomAttr object that corresponds to the attribute called name.

If no such attribute exists a \l{QDomNode::isNull()}{null attribute} is returned.

See also
setAttributeNode(), attribute(), setAttribute(), attributeNodeNS()

Definition at line 4390 of file qdom.cpp.

References IMPL, QDomNode::impl, and QDomAttr.

Referenced by NodeElements().

+ Here is the caller graph for this function:

◆ attributeNodeNS()

QDomAttr QDomElement::attributeNodeNS ( const QString & nsURI,
const QString & localName )

Returns the QDomAttr object that corresponds to the attribute with the local name localName and the namespace URI nsURI.

If no such attribute exists a \l{QDomNode::isNull()}{null attribute} is returned.

See also
setAttributeNode(), attribute(), setAttribute()

Definition at line 4564 of file qdom.cpp.

References IMPL, QDomNode::impl, QDomNode::localName(), and QDomAttr.

+ Here is the call graph for this function:

◆ attributeNS()

QString QDomElement::attributeNS ( const QString & nsURI,
const QString & localName,
const QString & defValue = QString() ) const

Returns the attribute with the local name localName and the namespace URI nsURI.

If the attribute does not exist defValue is returned.

See also
setAttributeNS(), attributeNodeNS(), setAttributeNodeNS(), attribute()

Definition at line 4466 of file qdom.cpp.

References IMPL, QDomNode::impl, and QDomNode::localName().

+ Here is the call graph for this function:

◆ attributes()

QDomNamedNodeMap QDomElement::attributes ( ) const

Returns a QDomNamedNodeMap containing all this element's attributes.

See also
attribute(), setAttribute(), attributeNode(), setAttributeNode()

Definition at line 4267 of file qdom.cpp.

References IMPL, QDomNode::impl, and QDomNode::QDomNamedNodeMap.

◆ elementsByTagName()

QDomNodeList QDomElement::elementsByTagName ( const QString & tagname) const

Returns a QDomNodeList containing all descendants of this element named tagname encountered during a preorder traversal of the element subtree with this element as its root.

The order of the elements in the returned list is the order they are encountered during the preorder traversal.

See also
elementsByTagNameNS(), QDomDocument::elementsByTagName()

Definition at line 4435 of file qdom.cpp.

References QDomNode::impl, and QDomNode::QDomNodeList.

◆ elementsByTagNameNS()

QDomNodeList QDomElement::elementsByTagNameNS ( const QString & nsURI,
const QString & localName ) const

Returns a QDomNodeList containing all descendants of this element with local name localName and namespace URI nsURI encountered during a preorder traversal of the element subtree with this element as its root.

The order of the elements in the returned list is the order they are encountered during the preorder traversal.

See also
elementsByTagName(), QDomDocument::elementsByTagNameNS()

Definition at line 4597 of file qdom.cpp.

References QDomNode::impl, QDomNode::localName(), and QDomNode::QDomNodeList.

+ Here is the call graph for this function:

◆ hasAttribute()

bool QDomElement::hasAttribute ( const QString & name) const

Returns true if this element has an attribute called name; otherwise returns false.

{Note:} This function does not take the presence of namespaces into account. As a result, the specified name will be tested against fully-qualified attribute names that include any namespace prefixes that may be present.

Use hasAttributeNS() to explicitly test for attributes with specific namespaces and names.

Definition at line 4452 of file qdom.cpp.

References IMPL, and QDomNode::impl.

◆ hasAttributeNS()

bool QDomElement::hasAttributeNS ( const QString & nsURI,
const QString & localName ) const

Returns true if this element has an attribute with the local name localName and the namespace URI nsURI; otherwise returns false.

Definition at line 4607 of file qdom.cpp.

References IMPL, QDomNode::impl, and QDomNode::localName().

+ Here is the call graph for this function:

◆ nodeType()

QDomNode::NodeType QDomElement::nodeType ( ) const
inline

Returns ElementNode.

Definition at line 516 of file qdom.h.

◆ operator=()

QDomElement & QDomElement::operator= ( const QDomElement & other)
default

Assigns other to this DOM element.

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().

◆ removeAttribute()

void QDomElement::removeAttribute ( const QString & name)

Removes the attribute called name name from this element.

See also
setAttribute(), attribute(), removeAttributeNS()

Definition at line 4376 of file qdom.cpp.

References IMPL, and QDomNode::impl.

◆ removeAttributeNode()

QDomAttr QDomElement::removeAttributeNode ( const QDomAttr & oldAttr)

Removes the attribute oldAttr from the element and returns it.

See also
attributeNode(), setAttributeNode()

Definition at line 4419 of file qdom.cpp.

References IMPL, QDomNode::impl, and QDomAttr.

◆ removeAttributeNS()

void QDomElement::removeAttributeNS ( const QString & nsURI,
const QString & localName )

Removes the attribute with the local name localName and the namespace URI nsURI from this element.

See also
setAttributeNS(), attributeNS(), removeAttribute()

Definition at line 4546 of file qdom.cpp.

References IMPL, QDomNode::impl, and QDomNode::localName().

+ Here is the call graph for this function:

◆ setAttribute() [1/7]

void QDomElement::setAttribute ( const QString & name,
const QString & value )

Adds an attribute called name with value value.

If an attribute with the same name exists, its value is replaced by value.

See also
attribute(), setAttributeNode(), setAttributeNS()

Definition at line 4294 of file qdom.cpp.

References IMPL, and QDomNode::impl.

Referenced by FileContent().

+ Here is the caller graph for this function:

◆ setAttribute() [2/7]

void QDomElement::setAttribute ( const QString & name,
double value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The formatting always uses QLocale::C.

Definition at line 4362 of file qdom.cpp.

References IMPL, QDomNode::impl, and QString::setNum().

+ Here is the call graph for this function:

◆ setAttribute() [3/7]

void QDomElement::setAttribute ( const QString & name,
float value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The formatting always uses QLocale::C.

Definition at line 4348 of file qdom.cpp.

References IMPL, QDomNode::impl, and QString::setNum().

+ Here is the call graph for this function:

◆ setAttribute() [4/7]

void QDomElement::setAttribute ( const QString & name,
int value )
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The formatting always uses QLocale::C.

Definition at line 482 of file qdom.h.

References setAttribute().

+ Here is the call graph for this function:

◆ setAttribute() [5/7]

void QDomElement::setAttribute ( const QString & name,
qlonglong value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The formatting always uses QLocale::C.

Definition at line 4320 of file qdom.cpp.

References IMPL, QDomNode::impl, and QString::setNum().

+ Here is the call graph for this function:

◆ setAttribute() [6/7]

void QDomElement::setAttribute ( const QString & name,
qulonglong value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The formatting always uses QLocale::C.

Definition at line 4334 of file qdom.cpp.

References IMPL, QDomNode::impl, and QString::setNum().

+ Here is the call graph for this function:

◆ setAttribute() [7/7]

void QDomElement::setAttribute ( const QString & name,
uint value )
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The formatting always uses QLocale::C.

Definition at line 484 of file qdom.h.

References setAttribute().

+ Here is the call graph for this function:

◆ setAttributeNode()

QDomAttr QDomElement::setAttributeNode ( const QDomAttr & newAttr)

Adds the attribute newAttr to this element.

If the element has another attribute that has the same name as newAttr, this function replaces that attribute and returns it; otherwise the function returns a \l{QDomNode::isNull()}{null attribute}.

See also
attributeNode(), setAttribute(), setAttributeNodeNS()

Definition at line 4407 of file qdom.cpp.

References IMPL, QDomNode::impl, and QDomAttr.

◆ setAttributeNodeNS()

QDomAttr QDomElement::setAttributeNodeNS ( const QDomAttr & newAttr)

Adds the attribute newAttr to this element.

If the element has another attribute that has the same local name and namespace URI as newAttr, this function replaces that attribute and returns it; otherwise the function returns a \l{QDomNode::isNull()}{null attribute}.

See also
attributeNodeNS(), setAttributeNS(), setAttributeNode()

Definition at line 4581 of file qdom.cpp.

References IMPL, QDomNode::impl, and QDomAttr.

◆ setAttributeNS() [1/6]

void QDomElement::setAttributeNS ( const QString & nsURI,
const QString & qName,
const QString & value )

Adds an attribute with the qualified name qName and the namespace URI nsURI with the value value.

If an attribute with the same local name and namespace URI exists, its prefix is replaced by the prefix of qName and its value is replaced by value.

Although qName is the qualified name, the local name is used to decide if an existing attribute's value should be replaced.

See also
attributeNS(), setAttributeNodeNS(), setAttribute()

Definition at line 4485 of file qdom.cpp.

References IMPL, and QDomNode::impl.

◆ setAttributeNS() [2/6]

void QDomElement::setAttributeNS ( const QString & nsURI,
const QString & qName,
double value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 4531 of file qdom.cpp.

References IMPL, QDomNode::impl, and QString::setNum().

+ Here is the call graph for this function:

◆ setAttributeNS() [3/6]

void QDomElement::setAttributeNS ( const QString & nsURI,
const QString & qName,
int value )
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 497 of file qdom.h.

◆ setAttributeNS() [4/6]

void QDomElement::setAttributeNS ( const QString & nsURI,
const QString & qName,
qlonglong value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 4507 of file qdom.cpp.

References IMPL, QDomNode::impl, and QString::setNum().

+ Here is the call graph for this function:

◆ setAttributeNS() [5/6]

void QDomElement::setAttributeNS ( const QString & nsURI,
const QString & qName,
qulonglong value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 4519 of file qdom.cpp.

References IMPL, QDomNode::impl, and QString::setNum().

+ Here is the call graph for this function:

◆ setAttributeNS() [6/6]

void QDomElement::setAttributeNS ( const QString & nsURI,
const QString & qName,
uint value )
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 499 of file qdom.h.

◆ setTagName()

void QDomElement::setTagName ( const QString & name)

Sets this element's tag name to name.

See also
tagName()

Definition at line 4239 of file qdom.cpp.

References QDomNode::impl, and QDomNodePrivate::name.

◆ tagName()

QString QDomElement::tagName ( ) const

Returns the tag name of this element.

For an XML element like this:

the tagname would return "img".

See also
setTagName()

Definition at line 4254 of file qdom.cpp.

References QDomNode::impl, and QDomNodePrivate::nodeName().

Referenced by FileContent(), and NodeElements().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ text()

QString QDomElement::text ( ) const

Returns the element's text or an empty string.

Example:

The function text() of the QDomElement for the {

} tag, will return the following text: \snippet code/src_xml_dom_qdom_snippet.cpp 14 Comments are ignored by this function. It only evaluates QDomText and QDomCDATASection objects.

Definition at line 4628 of file qdom.cpp.

References IMPL, and QDomNode::impl.

Friends And Related Symbol Documentation

◆ QDomAttr

friend class QDomAttr
friend

◆ QDomDocument

friend class QDomDocument
friend

Definition at line 523 of file qdom.h.

◆ QDomNode

friend class QDomNode
friend

Definition at line 524 of file qdom.h.


The documentation for this class was generated from the following files: