Boost logo

Boost Users :

Subject: [Boost-users] [property_tree] Parsing vectors of objects
From: Michael Powell (mwpowellhtx_at_[hidden])
Date: 2013-07-21 08:30:01


Hello,

I want to parse to and from Xml (or possibly Json) using the property
tree. I've got a simple POCO parsing, but now I need to include
vectors of objects.

Furthermore, I understand the property tree paths are pretty
cumbersome. Not so much through a thin vernier, template function,
something like that, but anywho...

Here's the desired output I want in Xml, something like this:

<output>
  <apples>
    <apple grower="red" />
    <apple grower="green" />
    <apple grower="golden" />
  </apples>
  <oranges>
    <orange freshness="picked" />
    <orange freshness="market" />
    <orange freshness="store" />
  </oranges>
  <items>
    <item name="" id="">1234</item>
    <item name="" id="">1234</item>
    <item name="" id="">1234</item>
  </items>
</output>

I understand the tree path might look something like this
"output.apples.apple.<xmlattr>.grower", but what about the vector?

Probably want to be trimming white spaces, indenting, as well.

Regards,

Michael Powell


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net