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.

Your post must include a link to this post.

How does this work?
Write a response on your own website and include a link to this post. Then submit your response’s URL here. Your response may appear here after moderation. To update or remove it, edit or delete your original post and submit the same URL again. Learn more about Webmentions.