Linq-to-XML with XDocument namespace issue

[亡魂溺海] 提交于 2019-12-06 07:19:46

The URL itself is irrelevant here - it's just a token for the namespace, really. I don't believe LINQ to XML will try to fetch it.

However, you need to use it to construct the XName to search for:

XNamespace ns = "https://www.sisow.nl/Sisow/REST";
var banks = doc.Descendants(ns + "issuer")
               .Select(x => new Bank((int) x.Element(ns + "issuerid"),
                                     (string) x.Element(ns + "issuername"))
               .ToList();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!