source: icGREP/icgrep-devel/icgrep/combine/pugixml/docs/samples/traverse_base.cpp @ 5516

Last change on this file since 5516 was 5516, checked in by faldebey, 2 years ago

added combinatorial testing tool

File size: 1.5 KB
Line 
1#include "pugixml.hpp"
2
3#include <string.h>
4#include <iostream>
5
6int main()
7{
8    pugi::xml_document doc;
9    if (!doc.load_file("xgconsole.xml")) return -1;
10
11    pugi::xml_node tools = doc.child("Profile").child("Tools");
12
13    // tag::basic[]
14    for (pugi::xml_node tool = tools.first_child(); tool; tool = tool.next_sibling())
15    {
16        std::cout << "Tool:";
17
18        for (pugi::xml_attribute attr = tool.first_attribute(); attr; attr = attr.next_attribute())
19        {
20            std::cout << " " << attr.name() << "=" << attr.value();
21        }
22
23        std::cout << std::endl;
24    }
25    // end::basic[]
26
27    std::cout << std::endl;
28
29    // tag::data[]
30    for (pugi::xml_node tool = tools.child("Tool"); tool; tool = tool.next_sibling("Tool"))
31    {
32        std::cout << "Tool " << tool.attribute("Filename").value();
33        std::cout << ": AllowRemote " << tool.attribute("AllowRemote").as_bool();
34        std::cout << ", Timeout " << tool.attribute("Timeout").as_int();
35        std::cout << ", Description '" << tool.child_value("Description") << "'\n";
36    }
37    // end::data[]
38
39    std::cout << std::endl;
40
41    // tag::contents[]
42    std::cout << "Tool for *.dae generation: " << tools.find_child_by_attribute("Tool", "OutputFileMasks", "*.dae").attribute("Filename").value() << "\n";
43
44    for (pugi::xml_node tool = tools.child("Tool"); tool; tool = tool.next_sibling("Tool"))
45    {
46        std::cout << "Tool " << tool.attribute("Filename").value() << "\n";
47    }
48    // end::contents[]
49}
50
51// vim:et
Note: See TracBrowser for help on using the repository browser.