2
Reply

Help on Copying a node from xml document to another

maan

maan

Jan 3 2012 10:01 AM
1.2k
Hi All,

I have xml file like this:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<defect>
<record-id>1458</record-id>
<defect-number>1458</defect-number>
<summary>Upgrade scripts</summary>
</defect>
<defect>
<record-id>1459</record-id>
<defect-number>1459</defect-number>
<summary>Upgrade scripts</summary>
</defect>

I need to find defect number first and the create a xml file for it. So my output should have two xml files 1458.xml and 1459.xml.
1458.xml should contain :
<defect>
<record-id>1458</record-id>
<defect-number>1458</defect-number>
<summary>Upgrade scripts</summary>
</defect>
1459.xml should contain :
<defect>
<record-id>1459</record-id>
<defect-number>1459</defect-number>
<summary>Upgrade scripts</summary>
</defect>
Please let me know the best approach using c# to do this.


Answers (2)