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
4
votes
1 answer

How to read field type from boost property tree

I'm using boost property trees to read values from a json file. { "some_values": { "field_1": "value_1", "field_2": true } } I can read the values with: spTree->get("some_values.field_1", …
stack user
  • 835
  • 1
  • 9
  • 28
4
votes
1 answer

Adding a sub child to boost ptree

Lets say I am aiming to create an xml in the following form:
I have the following code: ptree…
ashish g
  • 429
  • 1
  • 7
  • 16
4
votes
3 answers

adding namespaces to XML with boost

I'm trying to generate an xml using boost. Going fine so far, but the xml that gets generated needs to have a namespace. so instead of "Harry" it would say "Harry" Is there any way to add a namespace to the XML…
Aelion
  • 379
  • 1
  • 5
  • 16
4
votes
1 answer

Comparing boost property trees

Is it possible two compare property trees? There are operator overloads for == and != in ptree.hpp but using them gives me a compiler error. ptree a; ptree b; auto match = (a == b); Results in : 2>c:\program files (x86)\microsoft…
McAvoy
  • 55
  • 7
4
votes
1 answer

XML Path to second child

I want to put a new value to a child inside a ptree via path (no iteration) As example: #include #include #include int main() { using boost::property_tree::ptree; …
Viatorus
  • 1,804
  • 1
  • 18
  • 41
4
votes
1 answer

boost::property_tree without exceptions

I need to parse some INI files. To do this, I'm trying to use boost::property_tree, but in my system exceptions are not allowed. How can I disable the exception support when using boost::property_tree? If there's no way to do this, any…
Valmir
  • 401
  • 1
  • 5
  • 14
4
votes
1 answer

how to get boost json to use the correct data types

When I put_value using an int, it gets written as a string. Does anyone know how to get it to print as an int? #include #include #include using…
joels
  • 7,249
  • 11
  • 53
  • 94
4
votes
1 answer

Boost's property tree: deleting a child knowing its path

Is there an easy to delete a child (and its eventual subchildren) from a property tree that is known via its path? The following auto child = ptree.get_child(path); child.clear(); does not actually remove the child, but only its content. The erase…
P-Gn
  • 23,115
  • 9
  • 87
  • 104
4
votes
1 answer

boost::property_tree::ordered_end() missing

I am trying to iterate over a boost property tree. The docs state that You can get an ordered view of all children by using ordered_begin() and ordered_end(). However, when I write for ( boost::property_tree::ptree::const_assoc_iterator it = …
ravenspoint
  • 19,093
  • 6
  • 57
  • 103
4
votes
1 answer

Boost property tree count does not count the childs?

I have a json that looks like this: {"field":{"val1":25, "val2":48, "name1":"qqd"}} When I do a verification of the received json has the specific fields like this: std::size_t fcnt = pt.count("field"); std::size_t val1cnt =…
sop
  • 3,445
  • 8
  • 41
  • 84
4
votes
1 answer

C++ boost json ptree parser fail to parse string

i'm trying to send json messages trough boost message_queue using ptree for storing informations localy. this is the code of the receiver: #include #include #include //#include…
kurojishi
  • 321
  • 1
  • 4
  • 12
3
votes
1 answer

boost::property_tree::json_parser::read_json & Twitter?

I tried real quick as a test to see if I can pipe my twitter feed to boost's JSON parser. No dice. My JSON parser cannot handle the following…
user805547
  • 1,245
  • 1
  • 15
  • 23
3
votes
1 answer

Templated class around boost::ptree headache

I'm struggling to find out why code with the following snippet will not compile. There may be something I don't understand about class templates (ie the typedef typename thing) but I don't think that's it in this particular case. template
Benjamin Pritchard
  • 915
  • 2
  • 8
  • 15
3
votes
1 answer

Write CDATA XML-node with boost::property_tree

I'm trying to write an XML-file containing CDATA-nodes using boost::property_tree. However since characters such as <, >, &, etc. are escaped automatically when writing the XML-file, something like xml.put("node", "") will…
3
votes
0 answers

How to read value key pair form xml using boost ptree

I have the following structure of an xml file
schorsch312
  • 5,553
  • 5
  • 28
  • 57