boost::property_tree XML pretty printing

前端 未结 3 1012
独厮守ぢ
独厮守ぢ 2020-12-02 13:12

I\'m using boost::property_tree to read and write XML configuration files in my application. But when I write the file the output looks kind of ugly with lots of empty lines

3条回答
  •  忘掉有多难
    2020-12-02 14:14

    This question is quite old, but I investigated your problem again, lately, because it got a lot worse now that property_tree translates newlines to

    
        
    

    In my opinion this is a bug, because elements, which contains only whitespace - newlines, spaces and tabs, are treated as text elements. trim_whitespace is only a bandaid and normalizes ALL whitespace in the property_tree.

    I reported the bug over here and also attached a .diff to fix this behaviour in Boost 1.59 in case trim_whitespace is not used: https://svn.boost.org/trac/boost/ticket/11600

提交回复
热议问题