From 69a3d9be05e6cd1e664c099927b9588e96bd790b Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Wed, 30 Jun 2010 14:29:44 +0000 Subject: docs: Added load_options sample git-svn-id: http://pugixml.googlecode.com/svn/trunk@554 99668b35-9821-0410-8761-19e4c4f06640 --- docs/samples/load_options.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 docs/samples/load_options.cpp diff --git a/docs/samples/load_options.cpp b/docs/samples/load_options.cpp new file mode 100644 index 0000000..82273aa --- /dev/null +++ b/docs/samples/load_options.cpp @@ -0,0 +1,28 @@ +#include "pugixml.hpp" + +#include + +int main() +{ + pugi::xml_document doc; + +//[code_load_options + const char* source = "<"; + + // Parsing with default options; note that comment node is not added to the tree, and entity reference < is expanded + doc.load(source); + std::cout << "First node value: [" << doc.first_child().value() << "], node child value: [" << doc.child_value("node") << "]\n"; + + // Parsing with additional parse_comments option; comment node is now added to the tree + doc.load(source, pugi::parse_default | pugi::parse_comments); + std::cout << "First node value: [" << doc.first_child().value() << "], node child value: [" << doc.child_value("node") << "]\n"; + + // Parsing with additional parse_comments option and without the (default) parse_escapes option; < is not expanded + doc.load(source, (pugi::parse_default | pugi::parse_comments) & ~pugi::parse_escapes); + std::cout << "First node value: [" << doc.first_child().value() << "], node child value: [" << doc.child_value("node") << "]\n"; + + // Parsing with minimal option mask; comment node is not added to the tree, and < is not expanded + doc.load(source, pugi::parse_minimal); + std::cout << "First node value: [" << doc.first_child().value() << "], node child value: [" << doc.child_value("node") << "]\n"; +//] +} -- cgit v1.2.3