Mercurial > minori
comparison dep/pugixml/docs/samples/save_subtree.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 // tag::code[] | |
8 // get a test document | |
9 pugi::xml_document doc; | |
10 doc.load_string("<foo bar='baz'><call>hey</call></foo>"); | |
11 | |
12 // print document to standard output (prints <?xml version="1.0"?><foo bar="baz"><call>hey</call></foo>) | |
13 doc.save(std::cout, "", pugi::format_raw); | |
14 std::cout << std::endl; | |
15 | |
16 // print document to standard output as a regular node (prints <foo bar="baz"><call>hey</call></foo>) | |
17 doc.print(std::cout, "", pugi::format_raw); | |
18 std::cout << std::endl; | |
19 | |
20 // print a subtree to standard output (prints <call>hey</call>) | |
21 doc.child("foo").child("call").print(std::cout, "", pugi::format_raw); | |
22 std::cout << std::endl; | |
23 // end::code[] | |
24 } | |
25 | |
26 // vim:et |