How are attributes parsed in Boost.PropertyTree?

the_drow picture the_drow · Sep 11, 2010 · Viewed 19.6k times · Source

Say I have this XML format:

<Widget type="SomeWidget" name="foo">
   <Event name="onmouseover">
      dostuff();
   </Event>
</Widget>

How do I read the attributes using Boost.PropertyTree?

Answer

Kevin Zhao picture Kevin Zhao · Oct 10, 2011

If xml has such content:

<mode fullscreen="true">mode xxx</mode>

Use boost::property code:

get<string>("mode.<xmlattr>.fullscreen") 

Oh yeah, it's ugly!