summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorarseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640>2013-07-10 04:47:25 +0000
committerarseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640>2013-07-10 04:47:25 +0000
commite300701d3fd1b4f6bcd41c0caf92d2a820db0e5b (patch)
tree68b4f9a248df527e2fd29038e5e30f3bc29fd42c /docs
parent4c57df7cb6d56af79de92197030e734f8751a7af (diff)
docs: XPath select_single_node sample checks return value for clarity
git-svn-id: http://pugixml.googlecode.com/svn/trunk@949 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'docs')
-rw-r--r--docs/samples/xpath_select.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/docs/samples/xpath_select.cpp b/docs/samples/xpath_select.cpp
index c098bd1..51ede61 100644
--- a/docs/samples/xpath_select.cpp
+++ b/docs/samples/xpath_select.cpp
@@ -10,17 +10,18 @@ int main()
//[code_xpath_select
pugi::xpath_node_set tools = doc.select_nodes("/Profile/Tools/Tool[@AllowRemote='true' and @DeriveCaptionFrom='lastparam']");
- std::cout << "Tools:";
+ std::cout << "Tools:\n";
for (pugi::xpath_node_set::const_iterator it = tools.begin(); it != tools.end(); ++it)
{
pugi::xpath_node node = *it;
- std::cout << " " << node.node().attribute("Filename").value();
+ std::cout << node.node().attribute("Filename").value() << "\n";
}
pugi::xpath_node build_tool = doc.select_single_node("//Tool[contains(Description, 'build system')]");
- std::cout << "\nBuild tool: " << build_tool.node().attribute("Filename").value() << "\n";
+ if (build_tool)
+ std::cout << "Build tool: " << build_tool.node().attribute("Filename").value() << "\n";
//]
}