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(std::basic_istream< typename Ptree::key_type::value_type > & stream, 
                Ptree & pt, int flags = 0);

Description

Reads XML from an input stream 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:

flags

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

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

  • no_comments <ndash></ndash> Skip XML comments.

  • trim_whitespace <ndash></ndash> Trim leading and trailing whitespace from text, and collapse sequences of whitespace.

pt

The property tree to populate.

stream

Stream from which to read in the property tree.

Throws:

xml_parser_error In case of error deserializing the property tree.

PrevUpHomeNext