> How can I modify an attribute in a xml file?
***
using System.Xml;
....
XmlDocument MyDoc = new XmlDocument();
try {
MyDoc.LoadXml("<root><child name=\"Change me\" /></root>");
XmlElement TempNode = MyDoc.SelectSingleNode("root//child") as XmlElement;
if (TempNode != null)
TempNode.SetAttribute("name", "new value");
MessageBox.Show(MyDoc.OuterXml);
} catch (XmlException) {
// Handle parse error here
}
***
Hope this helps,
Mike
- Microsoft Visual Basic MVP -
E-Mail:
ED***@mvps.org
WWW:
Http://EDais.mvps.org/