Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Function template read_xml

boost::property_tree::xml_parser::read_xml

Synopsis

// In header: <boost/property_tree/xml_parser.hpp>


template<typename Ptree> 
  void read_xml(const std::string & filename, Ptree & pt, int flags = 0, 
                const std::locale & loc = std::locale());

Description

Reads XML from a file using the given locale and translates it to property tree.

[Note] Note

Clears existing contents of property tree. In case of error the property tree unmodified.

XML attributes are placed under keys named <xmlattr>.

Parameters:

filename

The file from which to read in the property tree.

flags

Flags controlling the bahviour of the parser. The following flags are supported:

  • no_concat_text – Prevents concatenation of text nodes into datastring of property tree. Puts them in separate <xmltext> strings instead.

  • no_comments – Skip XML comments.

loc

The locale to use when reading in the file contents.

pt

The property tree to populate.

Throws:

xml_parser_error In case of error deserializing the property tree.

PrevUpHomeNext