Ticket #12658: example.cpp

File example.cpp, 685 bytes (added by jakjas <jak.jaskiewicz@…>, 6 years ago)

simple piece of code to reproduce described problem

Line 
1#include <iostream>
2#include <sstream>
3#include <string>
4#include <boost/property_tree/ptree.hpp>
5#include <boost/property_tree/xml_parser.hpp>
6
7
8int main()
9{
10 std::string input_text = "<Element><SubElement><ThirdNesting>Item</></Another></Whatever>";
11 std::stringstream input_stream;
12 std::stringstream output_stream;
13
14 input_stream << input_text;
15 boost::property_tree::ptree xml;
16 boost::property_tree::read_xml(input_stream, xml);
17 boost::property_tree::write_xml(output_stream, xml);
18 std::cout << "Input:" << std::endl;
19 std::cout << input_text << std::endl << std::endl;
20 std::cout << "Parsed:" << std::endl;
21 std::cout << output_stream.str() << std::endl;
22
23 return 0;
24}