Q:
How to get the attribute value of the root element(first element in my xml file) through LINQ.
XDocument xmlDoc = XDocument.Load(targetFileName);
<timetable ascttversion="2010" options="idprefix:realID">
I want to read the options
value.
Something like this:
XDocument xdoc = XDocument.Load(targetFileName);
var attrib = xdoc.Root.Attribute("options").Value;
// attrib = "idprefix:realID"
Following should do
xmlDoc.Root.Attribute("option").Value
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With