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

Automatic type in Boost's Property Tree

Currently I have this code: if(!variables["width"].defaulted()) { configTree.put(treeNames["width"], variables["width"].as()); } if(!variables["height"].defaulted()) { configTree.put(treeNames["height"],…
Jookia
  • 6,544
  • 13
  • 50
  • 60
0
votes
1 answer

Multiple loads of property tree xml-parser exception

I am using property tree xml-parsing to edit some settings for my application I created a struct default-settings struct default_settings { std::string imPath; std::string calPath; std::string solPath; void load(const…
Poka Yoke
  • 373
  • 3
  • 8
  • 27
0
votes
1 answer

Boost property_tree time complexity

What is the time complexity of using boost property tree's get_child_optional method? How fast or slow is it as compared to std::unordered_map lookup if we store node name and property_tree as KV pair? No doc found for the same
0
votes
0 answers

How to handle json references with property_tree::read_json?

JSON proposes a way to reference an element in the same, or a different, file: https://json-spec.readthedocs.io/reference.html How to make property_tree::read_json to properly handle these references ?
Barth
  • 15,135
  • 20
  • 70
  • 105
0
votes
0 answers

boost::property_tree::write_json() cannot open file

This is the code that I use to write the boost property tree structure into a file void writeConfigurationFile(std::string filePath, boost::property_tree::ptree &configurationTree) { try { boost::property_tree::write_json(filePath,…
liv2hak
  • 14,472
  • 53
  • 157
  • 270
0
votes
0 answers

Compilation errors when trying to include files from boost::property_tree

I am trying to use boost property tree in a project of mine, but when I try to build the components that use property tree, I get the following compilation errors: [ 6%] Built target distro_core_app_objects [ 10%] Built target…
0
votes
1 answer

Xml without indent char but with new line

Is there a way to write xml using boost::property_tree, without indent characters but with new line? Consider this code using namespace boost::property_tree; int main() { ptree tree; ptree* root = &tree.add("root", ""); …
JAJA
  • 40
  • 5
0
votes
0 answers

Boost's read_ini throws exception "'=' character not found in line" but file structure is correct

I have the following throwing an exception that is logged as: Failed to read in "Configuration File.ini". Exception: Configuration File.ini(1): '=' character not found in line However, the structure of the file is correct. The code: ptree pt; try…
Dash
  • 306
  • 1
  • 3
  • 16
0
votes
1 answer

boost::property_tree C++ JSON Writer, unwanted number formating

i am writing JSON files using boost::property_tree, my JSON contains large numbers, numbers are comma separated with EN_US.UTF-8 locale or separated by space with fr_FR.UTF-8 locale, i cannot get rid of the locale because i need to properly write…
Gregoire
  • 11
  • 2
0
votes
1 answer

How to add a key with a dot in the name to a json file

I am reading some information and I want to write it in json, but the names of some keys contain dots in the name. I want to get something like this: { "programs": { "tmp.exe" : "D:\\Directory\\Directory", "foo.exe" :…
AlexChek
  • 13
  • 2
0
votes
1 answer

boost property tree adds empty line with write_xml()

I am using boost (version 1.70.0) property tree. If I have this XML (no empty lines): .. and I…
M.K.
  • 159
  • 8
0
votes
1 answer

Why boost property tree xml serializer cannot preserve multi-line values?

I am working with boost property tree (v.1.72.5) to read and write xml files. I know that according to the documentation: The XML storage encoding does not round-trip perfectly. A read-write cycle loses trimmed whitespace, low-level formatting…
TonySalimi
  • 8,257
  • 4
  • 33
  • 62
0
votes
0 answers

How to read specific value from the xml file using boost xml in C++?

Using below xml message format, I am trying to read value of the key "zip code". i.e, "90952"
Name Alice Smith state CA zip code
John Paul Coder
  • 313
  • 1
  • 12
0
votes
2 answers

Boost PropertyTree: How to read json array into?

So having such json: { "config": { "name": "myconfig", "servecies": { "module": [ "file", "Admin", "HR" ], "notModule": "MyNotModule" } } } How to parse module array into…
Rella
  • 65,003
  • 109
  • 363
  • 636
0
votes
0 answers

Fail of auto with boost::property_tree?

While using boost::property_tree to parse json, I ran into an error and found a fix, but I do not understand why this fix works, or what the error was in the first place. It looks like auto fails here - thus the title - but I might also be…
Shiwayari
  • 315
  • 3
  • 12