I have an XML document that has nodes/values like this:
<data name="btnAutoTrans" xml:space="preserve">
<value>Auto Trans</value>
</data>
<data name="btnDieEngine" xml:space="preserve">
<value>Diesel Engine</value>
</data>
I need to select a single node for a specific name="btnDieEngine" (for example)
but all the code I have tried from searching google always returns NULL value.
The original code I had was
XmlNode node = xmldoc.SelectSingleNode("data[name='btnDieEngine']");
but this returns null.
Any help would be appreciated
Your XPath is invalid. Try that one:
XmlNode node = xmldoc.SelectSingleNode("data[@name='btnDieEngine']");
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.