kewlnamehuh / pugixml

Automatically exported from code.google.com/p/pugixml
0 stars 0 forks source link

Copying from mutliple documents #206

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have 3 xml documents in each document I need to search for a particular 
element and copy all of its child elements and data to a new document. How can 
this be done using pugixml. Thanks

Original issue reported on code.google.com by slimshe...@gmail.com on 17 May 2013 at 10:06

GoogleCodeExporter commented 9 years ago
You can use append_copy function:
http://pugixml.googlecode.com/svn/tags/latest/docs/manual/modify.html#manual.mod
ify.clone

i.e.
xml_document doc1, doc2, doc3, target;

xml_node node1 = doc1.child("node1").child("data1");
target.append_copy(node1);

xml_node node2 = doc2.child("node2").child("data2");
target.append_copy(node2);

xml_node node3 = doc3.child("node3").child("data3");
target.append_copy(node3);

Original comment by arseny.k...@gmail.com on 17 May 2013 at 2:40

GoogleCodeExporter commented 9 years ago

Original comment by arseny.k...@gmail.com on 25 May 2013 at 3:39