Questions tagged [boost-propertytree]

The Boost PropertyTree library provides a data structure that stores an arbitrarily deeply nested tree of values, indexed at each level by some key. It serializes and emulates XML, JSON and INI file structures.

The Boost PropertyTree library provides a data structure that stores an arbitrarily deeply nested tree of values, indexed at each level by some key. It serializes and emulates XML, JSON and INI file structures.

Note: Boost.PropertyTree is not a generic XML parser. It is not intended to be used as a fast-and-dirty way to load arbitrary XML files into memory. It's XML serialization capabilities are for serialization. It is intended to read the XML that it has written.

Please stop using Boost.PropertyTree as a generic XML parser.

354 questions
2
votes
1 answer

Accessing values using a boost::property_tree::string_path

I am playing with boost::property_tree::ptree, using namely the following json file: { "menu": { "foo": "true", "bar": "true", "value": "102.3E+06", "popup": [ { "value":…
malat
  • 12,152
  • 13
  • 89
  • 158
2
votes
1 answer
2
votes
1 answer

How to read Boost property_map with peer values with identical tag names

I am using the property_map from Boost c++ library v1.53, and its working great for me except I can't figure out how to parse data nodes with the same name that are peers of each other. As in the following XML:
ATLdev
  • 81
  • 1
  • 4
2
votes
0 answers

Inserting one boost property tree into another

I want to copy a subtree from one ptree to another. i.e. src: --some-subtree-- and generate: 1 --same-subtree-as-above-- do something…
Erez
  • 71
  • 4
2
votes
1 answer

Boost ptree iteration over two nodes

i have an xml like this testme testme1 testme2 testme testme1
Kathick
  • 1,395
  • 5
  • 19
  • 30
2
votes
1 answer

Improve Boost Property Tree performance

I coded a simple JSON wrapper on top of boost property trees (available at github). The focus of the library is to mimic interface of org.json (java JSON library). However it is taking 2 seconds to insert a string array of 1000000 (1M) elements. For…
mariolpantunes
  • 1,114
  • 2
  • 15
  • 28
2
votes
1 answer

Is Adding boost::any in a boost::property_tree Possible?

I am trying to store a boost::any type to a boost property tree. Here is some runnable example: #include #include #include #include #include #include #include…
Subhamoy S.
  • 6,566
  • 10
  • 37
  • 53
2
votes
1 answer

Using Multiple Flags When using read_xml() in Boost Property Tree 1.50

So I found the 'pretty printing' trimming white space flag referenced here: boost::property_tree XML pretty printing And I found the documentation for Boost::Property_Tree 1.50's read_xml()…
kashev
  • 382
  • 2
  • 15
2
votes
1 answer

Boost property-tree access violation

I have been trying to parse an XML file using boost's property tree, but every time I want to get the value of a string it throws an access violation exception. It works fine with integers so I'm a bit confused. Here's some of the code: class…
2
votes
1 answer

Reading array from boost::property_tree comes up blank

I am attempting to read array data from a boost::property_tree using the method shown in this question. In that example, the array is first read as a string, converted to a string stream, then read into an array. While implementing that solution,…
2NinerRomeo
  • 2,687
  • 4
  • 29
  • 35
1
vote
1 answer

Boost Property tree: how to store pointers in it?

I know it is not default and maybe not prefered way to use Boost Property tree. But It seems have all needed to create tree of named pointers. So I tried: #include #include #include template…
myWallJSON
  • 9,110
  • 22
  • 78
  • 149
1
vote
1 answer

boost::ptree is taking to much memory during push_back and put_child

datanode holds approximately data of 30MB when i push_back it to childnode then it takes memory of 200MB approximately and when I put this childnode into parent node again 200MB in this operation. I have stats all memory during this operation using…
1
vote
1 answer

boost property tree, iterators to an element for inserting?

I've searched a lot through the boost manual, and the internet, as I believe it is quite a standard feature? Well I'm looking into "merging" property trees. - I noticed the function insert, and I hope I can merge trees with this? Below is the line…
paul23
  • 8,799
  • 12
  • 66
  • 149
1
vote
0 answers

Output of json array with boost::property_tree

I wan't put to json data in std::unordered_map, for example this: std::unordered_map> data = { {"name", {"a", "b", "c", "d", "e"}}, {"price", {"1.1", "2.2", "3.3", "4.4", "5.5"}}, {"id", {"1", "2",…
rufous
  • 11
  • 2
1
vote
1 answer

What is the right way to put objects to boost::property_tree?

Consider following example: #include #include typedef boost::property_tree::ptree PT; struct Foo { int bar; int egg; Foo(): bar(), egg() {} }; int main() { Foo foo; foo.bar =…
rmflow
  • 4,445
  • 4
  • 27
  • 41