I have an XML document with a default namespace. I wasn't able to XPath query on it like /someroot/somechild until I discovered that I had to map the namespace to a prefix, say x, and use that prefix /x:someroot/x:somechild. This is all fine and well until I want to query for elements having some attribute, in which case /x:someroot/x:somechild[@x:someattribute] doesn't work, but /x:someroot/x:somechild[@someattribute] does. With no namespace prefixes defined in the XML document, I would expect every node, element, attribute, or otherwise, to inherit the default namespace. It seems, rather, that elements have inherited the default namespace, but attributes have not. Granted, my understanding of XML is quite limited, so what am I missing?
I am using a .NET XmlDocument object as my document to query on, an XmlNamespaceManager object to map the document's default namespace to a prefix, and the SelectSingleNode(String, XmlNamespaceManager) method to query on the document.