maan

maan

  • NA
  • 14
  • 3k

Help on Copying a node from xml document to another

Jan 3 2012 10:01 AM
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)