Get namespace from xml file C#

Scott Hanselman has an article on how to get the namespaces:

http://www.hanselman.com/blog/GetNamespacesFromAnXMLDocumentWithXPathDocumentAndLINQToXML.aspx


Thats because the default namespace is blank / not specified. I'd guess that you want GetNamespaceOfPrefix:

string elementNamespace = elemet.GetNamespaceOfPrefix("xs").NamespaceName;

Although that doesn't make a whole lot of sense to be honest - I'm not really sure what you are after.

Tags:

C#

Xml