Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Appending existing xml_node into another one using pugixml

How to append an exsiting pugi::xml_node into another one using pugixml ? the only function that i know is :

pugi::xml_node node = root.append_child("child");
like image 774
Mouhamed Fakarovic Avatar asked Oct 19 '25 01:10

Mouhamed Fakarovic


1 Answers

You should use cloning functions described here:

http://pugixml.org/docs/manual.html#modify.clone

Note that cloning functions can't clone the entire document - i.e. if you have a document that's loaded from this data:

<node><child /></node>

Then if you want to clone this data into <child> node, you should do:

doc.child("node").child("child").append_copy(doc.child("node"));

This will yield the following document:

<node><child><node><child /></node></child></node>
like image 143
zeuxcg Avatar answered Oct 20 '25 15:10

zeuxcg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!