source: icGREP/icgrep-devel/icgrep/combine/pugixml/docs/samples/load_options.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.4 KB
RevLine 
[5516]1#include "pugixml.hpp"
2
3#include <iostream>
4
5int main()
6{
7    pugi::xml_document doc;
8
9// tag::code[]
10    const char* source = "<!--comment--><node>&lt;</node>";
11
12    // Parsing with default options; note that comment node is not added to the tree, and entity reference &lt; is expanded
13    doc.load_string(source);
14    std::cout << "First node value: [" << doc.first_child().value() << "], node child value: [" << doc.child_value("node") << "]\n";
15
16    // Parsing with additional parse_comments option; comment node is now added to the tree
17    doc.load_string(source, pugi::parse_default | pugi::parse_comments);
18    std::cout << "First node value: [" << doc.first_child().value() << "], node child value: [" << doc.child_value("node") << "]\n";
19
20    // Parsing with additional parse_comments option and without the (default) parse_escapes option; &lt; is not expanded
21    doc.load_string(source, (pugi::parse_default | pugi::parse_comments) & ~pugi::parse_escapes);
22    std::cout << "First node value: [" << doc.first_child().value() << "], node child value: [" << doc.child_value("node") << "]\n";
23
24    // Parsing with minimal option mask; comment node is not added to the tree, and &lt; is not expanded
25    doc.load_string(source, pugi::parse_minimal);
26    std::cout << "First node value: [" << doc.first_child().value() << "], node child value: [" << doc.child_value("node") << "]\n";
27// end::code[]
28}
29
30// vim:et
Note: See TracBrowser for help on using the repository browser.