I need to replace the contents of the node in the XElement hierarchy when the element name and all attribute names and values ββmatch the input element. (If there is no match, you can add a new item.)
For example, if my data looks like this:
<root>
<thing1 a1="a" a2="b">one</thing1>
<thing2 a1="a" a2="a">two</thing2>
<thing2 a1="a" a3="b">three</thing2>
<thing2 a1="a">four</thing2>
<thing2 a1="a" a2="b">five</thing2>
<root>
I want to find the last element when I call a method with this input:
<thing2 a1="a" a2="b">new value</thing2>
The method should not have any hard-coded elements or attribute names - it just matches the data entry.
source
share