QDomNodeList Class

The QDomNodeList class is a list of QDomNode objects. More...

Header: #include <QDomNodeList>
CMake: find_package(Qt6 REQUIRED COMPONENTS Xml)
target_link_libraries(mytarget PRIVATE Qt6::Xml)
qmake: QT += xml

Note: All functions in this class are reentrant.

Public Types

(since 6.9) const_iterator
(since 6.9) const_pointer
(since 6.9) const_reference
(since 6.9) const_reverse_iterator
(since 6.9) difference_type
(since 6.9) pointer
(since 6.9) reference
(since 6.9) value_type

Public Functions

QDomNodeList()
QDomNodeList(const QDomNodeList &nodeList)
~QDomNodeList()
QDomNode at(int index) const
(since 6.9) QDomNodeList::const_iterator begin() const
(since 6.9) QDomNodeList::const_iterator cbegin() const
(since 6.9) QDomNodeList::const_iterator cend() const
(since 6.9) QDomNodeList::const_iterator constBegin() const
(since 6.9) QDomNodeList::const_iterator constEnd() const
int count() const
(since 6.9) QDomNodeList::const_reverse_iterator crbegin() const
(since 6.9) QDomNodeList::const_reverse_iterator crend() const
(since 6.9) QDomNodeList::const_iterator end() const
bool isEmpty() const
QDomNode item(int index) const
int length() const
(since 6.9) QDomNodeList::const_reverse_iterator rbegin() const
(since 6.9) QDomNodeList::const_reverse_iterator rend() const
int size() const
QDomNodeList &operator=(const QDomNodeList &other)
bool operator!=(const QDomNodeList &lhs, const QDomNodeList &rhs)
bool operator==(const QDomNodeList &lhs, const QDomNodeList &rhs)

Detailed Description

Lists can be obtained by QDomDocument::elementsByTagName() and QDomNode::childNodes(). The Document Object Model (DOM) requires these lists to be "live": whenever you change the underlying document, the contents of the list will get updated.

You can get a particular node from the list with item(). The number of items in the list is returned by length().

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

See also QDomNode::childNodes() and QDomDocument::elementsByTagName().

Member Type Documentation

[alias, since 6.9] QDomNodeList::const_iterator

[alias, since 6.9] QDomNodeList::const_reverse_iterator

Typedefs for an opaque class that implements a bidirectional iterator over a QDomNodeList.

Note: QDomNodeList does not support modifying nodes in-place, so there is no mutable iterator.

This typedef was introduced in Qt 6.9.

[alias, since 6.9] QDomNodeList::const_pointer

[alias, since 6.9] QDomNodeList::const_reference

[alias, since 6.9] QDomNodeList::difference_type

[alias, since 6.9] QDomNodeList::pointer

[alias, since 6.9] QDomNodeList::reference

[alias, since 6.9] QDomNodeList::value_type

Provided for STL-compatibility.

Note: QDomNodeList does not support modifying nodes in-place, so reference and const_reference are the same type, as are pointer and const_pointer.

This typedef was introduced in Qt 6.9.

Member Function Documentation

[noexcept, since 6.9] QDomNodeList::const_iterator QDomNodeList::begin() const

[noexcept, since 6.9] QDomNodeList::const_iterator QDomNodeList::cbegin() const

[noexcept, since 6.9] QDomNodeList::const_iterator QDomNodeList::cend() const

[noexcept, since 6.9] QDomNodeList::const_iterator QDomNodeList::constBegin() const

[noexcept, since 6.9] QDomNodeList::const_iterator QDomNodeList::constEnd() const

[noexcept, since 6.9] QDomNodeList::const_iterator QDomNodeList::end() const

[noexcept, since 6.9] QDomNodeList::const_reverse_iterator QDomNodeList::crbegin() const

[noexcept, since 6.9] QDomNodeList::const_reverse_iterator QDomNodeList::crend() const

[noexcept, since 6.9] QDomNodeList::const_reverse_iterator QDomNodeList::rbegin() const

[noexcept, since 6.9] QDomNodeList::const_reverse_iterator QDomNodeList::rend() const

Returns a const_iterator or const_reverse_iterator, respectively, pointing to the first or one past the last item in the list.

Note: QDomNodeList does not support modifying nodes in-place, so there is no mutable iterator.

This function was introduced in Qt 6.9.

QDomNodeList::QDomNodeList()

Creates an empty node list.

QDomNodeList::QDomNodeList(const QDomNodeList &nodeList)

Constructs a copy of nodeList.

[noexcept] QDomNodeList::~QDomNodeList()

Destroys the object and frees its resources.

QDomNode QDomNodeList::at(int index) const

This function is provided for Qt API consistency. It is equivalent to item().

If index is negative or if index >= length() then a null node is returned (i.e. a node for which QDomNode::isNull() returns true).

int QDomNodeList::count() const

This function is provided for Qt API consistency. It is equivalent to length().

bool QDomNodeList::isEmpty() const

Returns true if the list contains no items; otherwise returns false. This function is provided for Qt API consistency.

QDomNode QDomNodeList::item(int index) const

Returns the node at position index.

If index is negative or if index >= length() then a null node is returned (i.e. a node for which QDomNode::isNull() returns true).

See also length().

int QDomNodeList::length() const

Returns the number of nodes in the list.

int QDomNodeList::size() const

This function is provided for Qt API consistency. It is equivalent to length().

QDomNodeList &QDomNodeList::operator=(const QDomNodeList &other)

Assigns other to this node list.

Related Non-Members

[noexcept] bool operator!=(const QDomNodeList &lhs, const QDomNodeList &rhs)

Returns true if the node lists lhs and rhs are not equal; otherwise returns false.

[noexcept] bool operator==(const QDomNodeList &lhs, const QDomNodeList &rhs)

Returns true if the node lists lhs and rhs are equal; otherwise returns false.