1
<top>
    <name>hanhao</name>
    <age>18</age>
<!--
    node name : name
    node value : hanhao

    node name : age
    node value : 18
-->
</top>

e.g. I want to delete the "top" node,at the same time ,remain its subnode "name" and "value" and remain the comment.

I try to do this by saving its subnode and command but failed because I don't know how to let rapidxml distinguish & save a comment

So i faced two ways to solve it.

plan A : use a function who can directly delete a node without its subnode

plan B : use a function who can distinguish & save a comment so that I can delete the whole node and rebuild it without "top" node

I am searching for a long time on net. But no use. If you know how to make it work , or you have a nice plan C , please help me.

Aaron Hao
  • 59
  • 8
  • Make sure you're passing `parse_comment_nodes` to the `parse()` function. Then you should be able to access comment nodes. – Roddy Nov 15 '17 at 09:05
  • I read the official document and get the answer(use node->type() == node_comment to distinguish it), thanks for your help sincerely! – Aaron Hao Nov 16 '17 at 02:21

0 Answers0