diff options
author | Nico Vertriest <nico.vertriest@qt.io> | 2020-07-01 08:58:05 +0200 |
---|---|---|
committer | Paul Wicking <paul.wicking@qt.io> | 2020-09-01 06:11:56 +0200 |
commit | 2c7d46727ed1de7c8233f0520cc40e9e6ce72fac (patch) | |
tree | 2af4fdeab40b525d1a8abfdc09e60d1ac9ba4f8e /src/xml/dom/qdom.cpp | |
parent | 1ca85a2fd14d3838df165fbf0ccf898a340743cf (diff) |
Doc: Make snippets XML compilable
Task-number: QTBUG-84459
Change-Id: I143a8b8869f7cb8547f1898831d0d6e86b7ac35d
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/xml/dom/qdom.cpp')
-rw-r--r-- | src/xml/dom/qdom.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index e6c21a3332..0856a83a52 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -1723,7 +1723,7 @@ QDomNode QDomNode::parentNode() const For example, if the XML document looks like this: - \snippet code/src_xml_dom_qdom.cpp 4 + \snippet code/src_xml_dom_qdom_snippet.cpp 4 Then the list of child nodes for the "body"-element will contain the node created by the <h1> tag and the node created by the @@ -1775,7 +1775,7 @@ QDomNode QDomNode::lastChild() const For example, if you have XML like this: - \snippet code/src_xml_dom_qdom.cpp 5 + \snippet code/src_xml_dom_qdom_snippet.cpp 5 and this QDomNode represents the <p> tag, previousSibling() will return the node representing the <h1> tag. @@ -1795,7 +1795,7 @@ QDomNode QDomNode::previousSibling() const If you have XML like this: - \snippet code/src_xml_dom_qdom.cpp 6 + \snippet code/src_xml_dom_qdom_snippet.cpp 6 and this QDomNode represents the <p> tag, nextSibling() will return the node representing the <h2> tag. @@ -3745,7 +3745,7 @@ void QDomAttrPrivate::save(QTextStream& s, int, int) const For example, the following piece of XML produces an element with no children, but two attributes: - \snippet code/src_xml_dom_qdom.cpp 7 + \snippet code/src_xml_dom_qdom_snippet.cpp 7 You can access the attributes of an element with code like this: @@ -4159,7 +4159,7 @@ void QDomElementPrivate::save(QTextStream& s, int depth, int indent) const If you want to access the text of a node use text(), e.g. - \snippet code/src_xml_dom_qdom.cpp 9 + \snippet code/src_xml_dom_qdom_snippet.cpp 9 The text() function operates recursively to find the text (since not all elements contain text). If you want to find all the text @@ -4181,7 +4181,7 @@ void QDomElementPrivate::save(QTextStream& s, int depth, int indent) const nextSiblingElement() and previousSiblingElement(). For example, to iterate over all child elements called "entry" in a root element called "database", you can use: - \snippet code/src_xml_dom_qdom.cpp 11 + \snippet code/src_xml_dom_qdom_snippet.cpp 11 For further information about the Document Object Model see \l{W3C DOM Level 1}{Level 1} and @@ -4248,7 +4248,7 @@ void QDomElement::setTagName(const QString& name) /*! Returns the tag name of this element. For an XML element like this: - \snippet code/src_xml_dom_qdom.cpp 12 + \snippet code/src_xml_dom_qdom_snippet.cpp 12 the tagname would return "img". @@ -4618,12 +4618,12 @@ bool QDomElement::hasAttributeNS(const QString& nsURI, const QString& localName) Returns the element's text or an empty string. Example: - \snippet code/src_xml_dom_qdom.cpp 13 + \snippet code/src_xml_dom_qdom_snippet.cpp 13 The function text() of the QDomElement for the \c{<h1>} tag, will return the following text: - \snippet code/src_xml_dom_qdom.cpp 14 + \snippet code/src_xml_dom_qdom_snippet.cpp 14 Comments are ignored by this function. It only evaluates QDomText and QDomCDATASection objects. @@ -4830,7 +4830,7 @@ void QDomCommentPrivate::save(QTextStream& s, int depth, int indent) const A comment in the parsed XML such as this: - \snippet code/src_xml_dom_qdom.cpp 15 + \snippet code/src_xml_dom_qdom_snippet.cpp 15 is represented by QDomComment objects in the parsed Dom tree. |