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
7
votes
2 answers

Parse XML with boost property tree

I have the following XML file and I want to store it using the below structures. the data structs: struct transitions { string oldstate; string event; string newstate; }; struct XML_Diagram { string…
Tg Cl
  • 93
  • 1
  • 1
  • 4
7
votes
1 answer

Updating XML file using Boost property_tree

I have the following XML file: 1 I want to add a new node: Parameter2="2" to the Data node. This code doesn't work, saved file still contains only one parameter: …
Alex F
  • 42,307
  • 41
  • 144
  • 212
7
votes
3 answers

How to convert class object to json string using boost library in C++?

I am fairly new to C++ and I apologise beforehand if you find this very easy. I have the following files POST1.h #ifndef POST1_HH #define POST1_HH #include #include #include…
K.K
  • 401
  • 5
  • 22
7
votes
1 answer

Boost: How to get a subtree form an existing property tree?

I am trying to get a subtree from a boost::ptree using get_child like this: I have: class ConfigFile { ptree pt; ConfigFile(const string& name) { read_json(name, pt); } ptree& getSubTree(const string& path) { ptree spt =…
thedarkside ofthemoon
  • 2,251
  • 6
  • 31
  • 48
7
votes
2 answers

writing more complex than trivial xml with boost property tree

UPD I've found answer to "formatting" issue here, so I remove this part of the question, please read updated question: I need to write xml to file system on c++. I've learned this titorial. In the tutorial pretty simple xml is used. My xml is more…
Oleg Vazhnev
  • 23,239
  • 54
  • 171
  • 305
7
votes
2 answers

Boost Property Tree and Xml parsing Problems

I'm using boost::property_tree. The documentation is very vague and overall unhelpful for the most part. Looking at the source/examples didn't help that much, either. What I'm wondering is the following:
UberJumper
  • 20,245
  • 19
  • 69
  • 87
7
votes
1 answer

what is the memory overhead for boost::property_tree::ptree

I have found that boost::property_tree::ptree has an enormous memory overhead. My estimate is that an empty ptree is about 150 bytes, and, any entry put in a ptree adds at least another 150 bytes. This makes it unusable for us for trees containing…
silvermangb
  • 355
  • 2
  • 11
7
votes
3 answers

omit xml declaration when saving xml with boost

Is it possible, via the xml_writer_settings used as third parameter in the write_xml call, to omit the xml declaration when the function saves the xml? I mean, I would like not to have the initial "xml version="blah" encoding="blah blah" part. I'm…
Magallo
  • 196
  • 2
  • 14
7
votes
1 answer

Concurrency problems wih Boost Property tree

I developed a simple wrapper that encapsulates a JSONObject with Boost Property trees. The problem is a segmentation fault in this code: void JSONObject::parse(const std::string &text) { std::istringstream ss(text); …
mariolpantunes
  • 1,114
  • 2
  • 15
  • 28
7
votes
4 answers

Boost property tree: Remove a node

How would you remove a node from boost xml property tree? I have a document like this: some/folder some/folder some/folder I know how to itereate and print all folders,…
Rasmus Styrk
  • 1,296
  • 2
  • 20
  • 36
6
votes
1 answer

iterate through boost property tree

I'm iterating over an XML document using boost property tree and storing the results in a struct. The issue I have is that I can only get to the first "item" nodes and can't access the second "item" nodes. I was hoping someone would point out where…
01100110
  • 2,294
  • 3
  • 23
  • 32
6
votes
2 answers

C++ Boost Property Tree Update Existing Node By Attribute Qualifier

Ok, so here's a sample of the XML structure: actual value
CapersL
  • 174
  • 2
  • 7
6
votes
1 answer

Any standard library implementation for boost::property tree

Is there an alternative to to "boost/property_tree" ? Actually I'm trying to remove all boost implementations of C++ and use standard library functions. I've been able to find alternatives to some other implementations of boost C++ but none so for…
Mayank Jha
  • 939
  • 3
  • 12
  • 24
6
votes
2 answers

where is boost property_tree::empty_ptree?

I'm using boots's property_tree library. I'm looking for a way to get a child node from a ptree object, but return an empty ptree if failed. I came across a nice example in property_tree/examples/empty_ptree_trick.cpp: void process_settings(const…
bavaza
  • 10,319
  • 10
  • 64
  • 103
6
votes
1 answer

How to output boost property tree as JSON encoded string?

Sometimes it is very useful to create JSON encoded strings for representing and exchanging data. What is be best way of encoding a Boost property tree into a JSON string?
Fernando
  • 1,477
  • 2
  • 14
  • 33
1 2
3
23 24