Advertisement
Guest User

Untitled

a guest
Aug 29th, 2014
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. boost::property_tree::wptree pt;
  2. std::wifstream f(L"C:/äöå/file.xml");
  3. boost::property_tree::read_xml(f, pt);
  4.  
  5. #include <boost/property_tree/xml_parser.hpp>
  6. #include <boost/iostreams/device/file_descriptor.hpp>
  7. #include <boost/iostreams/stream.hpp>
  8. #include <boost/filesystem.hpp>
  9. #include <iostream>
  10.  
  11. namespace pt = boost::property_tree;
  12. namespace io = boost::iostreams;
  13. namespace fs = boost::filesystem;
  14.  
  15. int main()
  16. {
  17. fs::wpath const fname = L"test.xml";
  18. io::file_descriptor_source fs(fname);
  19. io::stream<io::file_descriptor_source> fsstream(fs);
  20.  
  21. pt::ptree xml;
  22. pt::read_xml(fsstream, xml);
  23.  
  24. for (auto const& node : xml.get_child("root"))
  25. std::cout << node.first << ": " << node.second.get_value<std::string>() << "n";
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement