From e584ea337ede5b33d3e3f2165352a233b67b7fab Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Thu, 17 May 2018 08:02:51 -0700 Subject: docs: Mention that node is a container of children in ranged for section This is implicitly true due to the following section, but that was written before C++11 so this does deserve a special mention in ranged for section as well. Fixes #210. --- docs/manual.adoc | 7 +++++++ docs/manual.html | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/docs/manual.adoc b/docs/manual.adoc index ab06af9..7b75a23 100644 --- a/docs/manual.adoc +++ b/docs/manual.adoc @@ -1010,6 +1010,13 @@ This is an example of using these functions (link:samples/traverse_rangefor.cpp[ include::samples/traverse_rangefor.cpp[tags=code] ---- +While using `children()` makes the intent of the code clear, note that each node can be treated as a container of child nodes, since it provides `begin()`/`end()` member functions described in the next section. Because of this, you can iterate through node's children simply by using the node itself: + +[source] +---- +for (pugi::xml_node child: tool) +---- + [[access.iterators]] === Traversing node/attribute lists via iterators diff --git a/docs/manual.html b/docs/manual.html index 3be4a2b..43bb197 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -2244,6 +2244,14 @@ If your C++ compiler supports range-based for-loop (this is a C++ } +
+

While using children() makes the intent of the code clear, note that each node can be treated as a container of child nodes, since it provides begin()/end() member functions described in the next section. Because of this, you can iterate through node’s children simply by using the node itself:

+
+
+
+
for (pugi::xml_node child: tool)
+
+

5.6. Traversing node/attribute lists via iterators

@@ -5759,7 +5767,7 @@ If exceptions are disabled, then in the event of parsing failure the query is in
-- cgit v1.2.3