i want to extract a value from an XML File and i already saw some solutions but i couldnt find one that works for me.
Here is my Sample XML File (i want to extract the Serial Number)
<Other TrashCodeSample="SampleTextHere">
<Data key="SerialNumber">911987082611993854940173</Data><Data key="TrashNumber2">5346587345345</Data></Other>
I already got some Code but it only gives me the last Value in "Data"
XDocument doc = XDocument.Load(label3.Text);
var authors = doc.Descendants("Data");
foreach (var author in authors)
{
textBox1.Text = (string) author;
}
the Serial Number is the Value i want to get:
<Data key="SerialNumber">911987082611993854940173</Data>
- if Possible i want to Edit the Serial Number inside the XML
it would be easy if i only had one "Data" but thats not the case.. :/