I have this XML document:
<?xml version="1.0" encoding="utf-8"?>
<directoryresponse xmlns="https://www.sisow.nl/Sisow/REST" version="1.0.0">
<directory>
<issuer>
<issuerid>01</issuerid>
<issuername>ABN Amro Bank</issuername>
</issuer>
<issuer>
<issuerid>02</issuerid>
<issuername>ASN Bank</issuername>
</issuer>
</directory>
</directoryresponse>
And this does not work:
var banks = doc.Descendants("issuer").Select(x =>
new Bank(Convert.ToInt32(x.Element("issuerid").Value), x.Element("issuername").Value)).ToList();
But when I manual remove the directoryresponse xml namespace
xmlns="https://www.sisow.nl/Sisow/REST"
it works! The namespace url is a 404. So why doesn't the xdoc
ignore the namespace if it's a 404?
This also does not work: var banks = doc.Elements().Where(e => e.Name.LocalName == "issuer" ).Select(...
The main question is: how can I modify my code so that it ignores the 404 namespace?