我有一個簡單的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」標籤。 –