I've xml data inside a local variable xml
of type XMLDocument
I wish to save the xml data as it is into a local file.
I've tried something like System.IO.File.WriteAllText(@"C:\MyProfile\OutOut.txt", xml.ToString());
but doesn't work.
Can someone let me know how to proceed for this?
Also let me now if any additional data is needed.
Thanks.
**Update: ** The above task was accomplished by using XmlDocument.Save(FilePath);
now just a small update to the questio is like :
If I have to save only a specific parent node along with it's child nodes, how do I proceed
Sample xml file
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Master Name="Accounts">
<Employee>
<Section>
<Details>
<Name="abc" ID="68" PF="9999" />
</Details>
<Department DeptId="12" />
</Section>
<Section>
<Details>
<Name="xyz" ID="69" PF="9999" />
</Details>
<Department DeptId="13" />
</Section>
</Employee>
</Master>
Only Node <Employee>
and it's children.