我有一个简单的XML文档,
<S xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"><H></H></S>
我想找到所有的 "H" 节点。
XElement x = XElement.Parse("<S xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"><H></H></S>");
IEnumerable<XElement> h = x.Descendants("H");
if (h != null)
{
}
但是这段代码无法正常工作。 当我从S标签中删除命名空间时,代码可以正常工作。