Change node attribute value

  • Thread starter Thread starter Grant
  • Start date Start date
G

Grant

How would I change the value of an attribute in an XML node using C#?

I have tried "findnode.Attributes["ID"].InnerText = newValue;"
and
"Attribute attri = (XmlAttribute)findnode.Attributes["ID"].Value;"

but Im stuck! When I try casting, it say that it cannot convert a string to
an XMLAttribute or when I try setting it to a new value it says "Object
reference not set to an instance of an object."

-------XML--------
<attr-inst id="20" state="known">
<val>100</val>
</attr-inst>

Thanks for any help,
Grant
 
Back
Top