C# XPathSelectElement始终返回null
为什么节点总是空的?XPath应该是空的C# XPathSelectElement始终返回null,c#,xml,xpath,linq-to-xml,C#,Xml,Xpath,Linq To Xml,为什么节点总是空的?XPath应该是空的 string xml = @"<vehicle> <cars> <car>tet</car> </cars> </vehicle>"; XElement x = XElement.Parse(xml); var node = x.XPathSelectElement("//vehicle/cars"); 输出: 这也会回来null@HennovanRensburg
string xml = @"<vehicle> <cars> <car>tet</car> </cars> </vehicle>";
XElement x = XElement.Parse(xml);
var node = x.XPathSelectElement("//vehicle/cars");
输出:
这也会回来null@HennovanRensburg:使用汽车
var node = x.XPathSelectElement("cars");
<cars>
<car>tet</car>
</cars>