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"
以下应该做
xmlDoc.Root.Attribute("option").Value
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.