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");
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");
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>
I have found this methods as well: http://pugixml.googlecode.com/svn/tags/release-0.9/docs/manual/modify.html
xml_node xml_node::append_child(xml_node_type type = node_element);
xml_node xml_node::insert_child_after(xml_node_type type, const xml_node& node);
xml_node xml_node::insert_child_before(xml_node_type type, const xml_node& node);
insert_child_after and insert_child_before add the (existing) node before or after specified node/attribute.