Mercurial > minori
comparison dep/pugixml/docs/samples/traverse_rangefor.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 pugi::xml_node tools = doc.child("Profile").child("Tools"); | |
11 | |
12 // tag::code[] | |
13 for (pugi::xml_node tool: tools.children("Tool")) | |
14 { | |
15 std::cout << "Tool:"; | |
16 | |
17 for (pugi::xml_attribute attr: tool.attributes()) | |
18 { | |
19 std::cout << " " << attr.name() << "=" << attr.value(); | |
20 } | |
21 | |
22 for (pugi::xml_node child: tool.children()) | |
23 { | |
24 std::cout << ", child " << child.name(); | |
25 } | |
26 | |
27 std::cout << std::endl; | |
28 } | |
29 // end::code[] | |
30 } | |
31 | |
32 // vim:et |