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
1
vote
1 answer

boost read_xml from stringstream does not read xml format

I want to fill a boost::property_tree::ptree with the data from a xml, the xml format is in a string which I passed to stringstream and then I try to read it with read_xml, but the ptree data is null or empty when I look at the object while…
seak
  • 125
  • 2
  • 6
1
vote
1 answer

how to remove xml's attribute using boost's ptree?

how to remove xml attribute title using boost's ptree? I had one xml, I tried followed code to remove attribute title and save to new xml but failed(new.xml still had title attribute). xml:
jiafu
  • 6,338
  • 12
  • 49
  • 73
1
vote
1 answer

enum input from xml to c++ program using boost::property_tree

How do you read a enum-class from an XML file using the boost::property_tree library? I would like to avoid reading it as a string and mapping the string to the enum-class in my program.
Raymond Valdes
  • 1,161
  • 1
  • 9
  • 15
1
vote
1 answer

boost property_tree push_back VC2012

There have been a number of examples posted to the web that demonstrate how to create a JSON array using boost's property tree. The basic syntax is: boost::property_tree::ptree array; array.push_back(std::make_pair("",…
1
vote
1 answer

Two unicode code-points when using json_write()?

When using boost::property_tree::write_json() to write a JSON file, all unicode characters will be represented as two "/u"-code points. So ä will become \u00C3\u00A4. My problem is, that I am generating a JSON file which will be read via JQuery to…
1
vote
1 answer

boost::ptree and the KeyCompare function?

The Boost documentation doesn't elaborate much, but there is an (optional) KeyCompare function that can be passed to the ptree. Anyone have a good example of using a custom KeyCompare function? I have recently been working with a ptree that is…
ukdiveboy
  • 65
  • 7
1
vote
1 answer

Boost .ini file parser - multiple section name(s)

I am using boost::property_tree to parse ini files. I want to be able to do something like the following: data.ini: [electron] position=0,0,0 velocity=0,0,0 [proton] position=1,0,0 velocity=0,0,0 [proton] position=-1,0,0 velocity=0,0,0 Currently…
FreelanceConsultant
  • 13,167
  • 27
  • 115
  • 225
1
vote
2 answers

Boost Property Tree: Remove attribute from a node

I have the following XML file: ... …
Sean Lynch
  • 2,852
  • 4
  • 32
  • 46
1
vote
1 answer

boost property tree getting first element

I was wondering if there where some convenient way to access a known index of a list using the path methodology. My dream method float v = pt.get("root.list[0]); Current known method (or something like it) ptree::value_type listElement; …
Middy
  • 91
  • 1
  • 9
1
vote
1 answer

Boost XML- Property Tree - detailed error infos for xml read

I'm using the boost lib with property tree class. The functional part works fine with reading and writing a xml file but I'm trying to improve the error output for syntax and other errors. Also an output like "error in line 13" was planed to find…
fpdragon
  • 1,867
  • 4
  • 25
  • 36
1
vote
2 answers

Typedef'ing basic_ptree from Boost

I'm using Boost.PropertyTree for a project and I want to use user-defined types for Key and Data instead of the std::string that Boost uses in the ptree typedef. However when I typedef basic_ptree myself I get the following compiler errors: 1> …
1
vote
1 answer

How do we get objects in boost property tree

I need to understand and modify a sample code. I am stuck at some point and couldn't find any solution. Here is the code: void foo(std::istream& input) { using boost::property_tree::ptree; ptree pt; …
minyatur
  • 175
  • 2
  • 4
  • 11
1
vote
2 answers

boost::property_tree compile error (error C2061: syntax error : identifier 'p')

I'm struggling to compile some code that utilises the boost property tree. I'm using Visual Studio 2010. If I simplify the code as much as possible to reproduce the error, the code looks like the following... #include…
gmcc051
  • 390
  • 3
  • 17
1
vote
1 answer

Add child node to top of XML structure. Boost Property Tree

I'm writing a set of results to an XML file. Each result set contains a series of results. My problem is that (during several executions of the code) when I try to write some new results a result to a set, the XML parser gets the very first (top)…
nf313743
  • 4,129
  • 8
  • 48
  • 63
1
vote
0 answers

How to detect duplicate entries in a boost::property_tree

I'd like to recursively traverse a boost::property_tree with the specific aim of finding and culling duplicate entries. Is there a way, once an path in the tree has been discovered, to issue a get() on the parent tree which excludes some instance…
2NinerRomeo
  • 2,687
  • 4
  • 29
  • 35