XML namespace prefix 'xmlns' is not defined
Posted
Sun, Nov 25 2007 0:58
by
bill
When working with VB9 you may get this cryptic error :
XML namespace prefix 'xmlns' is not defined
If you are using only default namespaces you can fix this by including a definition for the xmlns as an Import statement or as an xmlns attribute on the XML literal. But if you are using prefixed namespaces imported at file level, then you must add an imports at project level via the project properties reference tab.
You have two choices:
- Import System.Xml.Linq for the entire project, or
- Import a namespace for the entire project
If you decide to import a namespace it can be any namespace at all. I named one _do_not_use. Problem is it will show up in XML axis properties in intellisense, but with a name like _do_not_use, that isn't really a big problem. Of course you could add one that you might want to use.
You may prefer to simply import System.Xml.Linq, but I thought I'd at least throw all the alternatives out there for you to decide what suits you best.
hopefully this is another bug that will make it into 2008 SP1 ;)