Reputation: 1844
I'm following the Five Minute Tutorial and I get as output (unsurprisingly) the file debug_settings_out.xml
.
But my problem is, that it isn't well formatted. It looks like this:
<?xml version="1.0" encoding="utf-8"?>
<debug><filename>debug.log</filename><level>2</level></debug>
and I want it to look like this:
<?xml version="1.0" encoding="utf-8"?>
<debug>
<filename>debug.log</filename>
<level>2</level>
</debug>
because it should be also manually editable. How can I achieve that?
I already found the settings I can pass to the parser, but none of them gave me the desired behaviour.
Upvotes: 3
Views: 3807
Reputation: 72063
The documentation of PropertyTree is pretty bad (I've recently started improving it). What you need to do is pass a correct xml_writer_settings object to write_xml.
write_xml(filename, tree, std::locale(),
xml_writer_make_settings(' ', 4));
Upvotes: 7