我有一些boost::property_tree::ptree
。我需要删除具有特定标签名称的一些元素的树。例如,源ptree
的 xml 如下:
<?xml version="1.0" encoding="utf-8"?>
<document>
<B atr="one" atr1="something">
<to_remove attr="two">10</to_remove>
</B>
<to_remove>
<C>value</C>
<D>other value</D>
</to_remove>
<E>nothing</E>
</document>
我想得到ptree
如下的xml:
<?xml version="1.0" encoding="utf-8"?>
<document>
<B atr="one" atr1="something" />
<E>nothing</E>
</document>
如何编写函数,生成ptree
带有移除<to_remove>
节点的新函数?