Given the following xml (simplified)
<root xmlns="http://schemas.datacontract.org/2004/07/Base" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Items>
<item xmlns:a="http://schemas.datacontract.org/2004/07/Base" i:type="a:A"></item>
<item xmlns:a="http://schemas.datacontract.org/2004/07/Base" i:type="a:B"></item>
</Items>
</root>
I'm trying to do something along these line.
XNamespace xmlInstanceNs = "http://www.w3.org/2001/XMLSchema-instance";
XNamespace baseNs = "http://schemas.datacontract.org/2004/07/Base";
var items = root.Descendants(baseNs + "item");
var aItems = items.Where(i => i.Attribute(xmlInstanceNs + "type").Value == baseNs + "A");
Of course this isnt working since the last line is basically comparing the string "a:A" to the XName "{http://schemas.datacontract.org/2004/07/Base}A" which arent identical.
Is there a way to parse the "a:A" string to its XName equivalent without having to manually iterate the xml to find all the namespace abbreviations?