Scott Hanselman

Does XmlDataSource.XPath accept namespace qualifications?

September 04, 2004 Comment on this post [2] Posted in ASP.NET | XML
Sponsored By

I'm glad I'm not the only one that notice this. It's such an incredibly obvious omission, That I immediately assumed it was my fault and I was missing something. Can someone let me know if I'm completely out of touch on this or is it true that XmlDataSource.XPath and XPathBinder don't accept namespace qualified documents for evaluation with XPath? I am in the middle of a chapter on System.Xml for .NET 2.0 and I am surprised to have hit upon this missing functionality.

Now playing: Angie Stone & Floetry - My Man

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
September 04, 2004 14:18
It's hard to believe they don't accept namespace qualified documents. XPath can't really work without namespaces. Wild guess: the bug reporter you reference misunderstood how default namespaces work in XPath (they don't) and is blaming Microsoft for what's really a bug in their own XPath expressions.
September 04, 2004 23:01
I hear ya, and I thought of that. I reflectored into the code though, and I can't see where they do any namespace resolution. I tried using the "def:" namespace prefix trick, but no luck.

Mind you, we're just talkingn about the *XPathBinder* - not XPath on .NET in general. There's just no way to pass the namespace prefix map to this databinding expression that I can see. Certainly if the work is done in the code behind, one can use a NamespaceManager and it all works fine. It's that the XmlDataSource control doesn't appear to support the use of one like all the other XPath enabled classes.

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.