Mercurial > minori
comparison dep/pugixml/docs/samples/xpath_select.cpp @ 367:8d45d892be88 default tip
*: instead of pugixml, use Qt XML features
this means we have one extra Qt dependency though...
author | Paper <paper@tflc.us> |
---|---|
date | Sun, 17 Nov 2024 22:55:47 -0500 |
parents | 886f66775f31 |
children |
comparison
equal
deleted
inserted
replaced
366:886f66775f31 | 367:8d45d892be88 |
---|---|
1 #include "pugixml.hpp" | |
2 | |
3 #include <iostream> | |
4 | |
5 int main() | |
6 { | |
7 pugi::xml_document doc; | |
8 if (!doc.load_file("xgconsole.xml")) return -1; | |
9 | |
10 // tag::code[] | |
11 pugi::xpath_node_set tools = doc.select_nodes("/Profile/Tools/Tool[@AllowRemote='true' and @DeriveCaptionFrom='lastparam']"); | |
12 | |
13 std::cout << "Tools:\n"; | |
14 | |
15 for (pugi::xpath_node_set::const_iterator it = tools.begin(); it != tools.end(); ++it) | |
16 { | |
17 pugi::xpath_node node = *it; | |
18 std::cout << node.node().attribute("Filename").value() << "\n"; | |
19 } | |
20 | |
21 pugi::xpath_node build_tool = doc.select_node("//Tool[contains(Description, 'build system')]"); | |
22 | |
23 if (build_tool) | |
24 std::cout << "Build tool: " << build_tool.node().attribute("Filename").value() << "\n"; | |
25 // end::code[] | |
26 } | |
27 | |
28 // vim:et |