My xml file:
<?xml version="1.0" encoding="utf-8"?>
<layout name="layout">
<section name="Header">
<placeholder name="headers" width="30" class="header">sam,pam</placeholder>
</section>
<section name="Content">
<placeholder name="RightA" width="55">location</placeholder>
</section>
</layout>
I want to replace whole node if its contain sam.Means if node contains sam I want to rewrite node:
<placeholder name="headers" width="4,5,91">sam,sam2,pam</placeholder>
instead of:
<placeholder name="headers" width="30" class="header">sam,pam</placeholder>
In c#:
XmlDocument doc = new XmlDocument();
string sFileName = @"FileNameWithPath";
doc.Load(sFileName );
foreach (XmlNode ....... )
{
//Need help hear how to loop and replace.
}
Thanks.
1 Answer