Boost C++ Libraries Home Libraries People FAQ More

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