Mercurial > minori
comparison dep/pugixml/docs/samples/traverse_iter.cpp @ 55:d10b6c6b432e
add xml lib, we will need to use it eventually
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Tue, 26 Sep 2023 12:37:08 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
54:466ac9870df9 | 55:d10b6c6b432e |
---|---|
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_iterator it = tools.begin(); it != tools.end(); ++it) | |
14 { | |
15 std::cout << "Tool:"; | |
16 | |
17 for (pugi::xml_attribute_iterator ait = it->attributes_begin(); ait != it->attributes_end(); ++ait) | |
18 { | |
19 std::cout << " " << ait->name() << "=" << ait->value(); | |
20 } | |
21 | |
22 std::cout << std::endl; | |
23 } | |
24 // end::code[] | |
25 } | |
26 | |
27 // vim:et |