Categories
Etc

XPathExpression.SetContext

After more digging, I found out that it is supported that you have to use the XPathExpression object to do it. You have to compile your XPath expression first using the XPathNavigator, and then you call SetContext on the XPathExpression, passing in your XmlNamespaceManager. Also, something that bit both Mike and I: the prefixes you put in the namespace manager have nothing to do with the prefixes that were originally in the serialized xml. You can make them whatever you want. That way, if you use namespaces without using prefixes, you can still assign a prefix inside the XmlNamespaceManager so that your XPath queries will work. This is devious, devious work.

Advertisements