| Home | Libraries | People | FAQ | More

## 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
Clears existing contents of property tree. In case of error the property tree unmodified.

| Note
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` – Prevents concatenation of text nodes into datastring of property tree. Puts them in separate `<xmltext>` strings instead. `no_comments` – Skip XML comments. `trim_whitespace` – 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.