I've been playing around with XmlDataProvider with inline XML. Here's my code:
<XmlDataProvider x:Key="InternalData" XPath="/Workspace">
<x:XData>
<Workspace xmlns="" Name="Workspace">
<Project Name="Project 1" />
<Project Name="Project 2" />
<Project Name="Project 3" />
</Workspace>
</x:XData>
</XmlDataProvider>
This is very similar to most of the examples I've seen using inline XML but I keep getting the error "XmlDataProvider has inline XML that does not explicitly set its XmlNamespace (xmlns="")". I know it's obvious but why would I get this error at all? It should be valid, no? And no one else seems to be having this issue, not when I search Google anyway.
Thanks in advance
Update: For further clarification, this error is only showing up in my Output window. It's not a compiler error and it doesn't prevent me from running my program. I can read the XML fine and display it in a TreeView. I'd just like to understand why I get the error in the first place.
For what it's worth, I had exactly the same error some time back, on exactly the same MSDN article (see http://blog.wouldbetheologian.com/2009/07/why-wpf-databinding-is-awful-technology.html for my griping about it). But as to why it's required: I'm completely mystified. It doesn't seem like it should be, since using xmlns="" and leaving it out should have the same effect. My guess is that it's some bizarre artifact of Microsoft's XAML-parsing engine (which of course is not precisely XML-compliant). Perhaps this artifact is intended (a feature), perhaps not (a bug).