Tôi có một XML đơn giản,XElement.Descendants không làm việc với namespace
<S xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"><H></H></S>
Tôi muốn tìm tất cả "H" nút.
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)
{
}
Nhưng mã này không hoạt động. Khi tôi xóa không gian tên từ thẻ S, mã hoạt động chính xác.
Câu hỏi này không liên quan gì đến WPF, nhân tiện ... –
Cảm ơn, tôi đã xóa thẻ "WPF". –