2014-02-06 26 views
0

我使用升壓1.51和有這樣的事情:使用boost :: property_tree,是否可以使用'。'創建xml屬性。在名字裏?

boost::property_tree::ptree some_tree; 
some_tree.put("hello.world.<xmlattr>.foo.bar","4711"); 

我希望得到

<hello> 
    <world foo.bar="4711"/> 
</hello> 

但我只得到

<hello> 
    <world foo=""/> 
</hello> 

使用boost :: property_tree,是否有可能創建一個屬性名稱包含'。'的xml文件。性格還是我需要去其他地方看?

回答

2

您必須使用除默認.以外的分隔符。試試這個,

boost::property_tree::ptree some_tree; 
some_tree.put(ptree::path("hello/world/<xmlattr>/foo.bar", '/'),"4711"); 
+0

謝謝,完美的作品 – Magnus

相關問題