I need to convert a specific part of an XML file to string, with the data in it varying. eg.
I have an xml file with this portion in it:
-<root>-<Data><1>data</1>
and I want to only convert that line to a string, not the entire file. This, I know how to do. My issue is that the data in "1" will change depending on the circumstances, and I still want to be able to use the same program to convert it regardless of what the data in "1" reads.
to read the "1" line without verying data I know I can use:
var xml = "<root><Data><1>data</1></Data></root>";
var xmlString = XElement.Parse(xml).Descendants("1").FirstOrDefault().Value;
but I don't know how to do it with the contents of "1" changing.
<1>element always a singular leaf? In other words, does it have any siblings or is it the only child element of<Data>?