我有一个简单的XML工作,XElement.Descendants没有命名空间
<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标签中删除命名空间时,代码正常工作。
这个问题与WPF无关,顺便说一下... –
谢谢,我删除了“WPF”标签。 –