How can I copy a block of XML from one document to the other?

balaganofff

New Member
I have two dataGridViews that load up an XML file each, I have made it so that you can drag and drop rows in between each of the grids. However at the moment, all that it does is copy the data from the dataGridView. This works fine however I need to copy all of the XML that is relevant to that row. Here is the XML that I have to work with:\[code\]<WindowBuilderProject> <stringtable> <stentry>0..607</stentry> //All of the other records <stentry> <index>608</index> <sid>MNUB_AUTO</sid> <val> <en>AUTO</en> </val> <params> <fontref>0</fontref> <numref>0</numref> <clip>FALSE</clip> <include>TRUE</include> <protected>FALSE</protected> <cwidth>-1</cwidth> <dwidth>0</dwidth> </params> </stentry> </stringtable></WindowBuilderProject>\[/code\]So I need to copy the XML of the row that the user has selected and insert it into the in the other (same format) XML document. So far I have this:\[code\]string location = "/WindowBuilderProject/stringtable/stentry[index='" + rowIndexOfItemUnderMouseToDrop + "']";XmlNode Copy = xDoc.ImportNode(xDoc2.SelectSingleNode(location), false);xDoc.DocumentElement.AppendChild(Copy); //This is just supposed to add it to the end, I will worry about ordering once it works\[/code\]It runs fine, but all that happens i I get a added to the bottom of the XML file. How can I select the whole block of XML?Thanks a lot for your help!
 
Back
Top