XNamespace.None Property gets the XNamespace object that corresponds to no namespace.
Imports <xmlns:aw="http://www.domain.com">
Module Module1
Sub Main()
Dim root As XElement = _
<Root>
<aw:ChildInNamespace>content</aw:ChildInNamespace>
<ChildInNoNamespace>content</ChildInNoNamespace>
</Root>
If (root.Name.Namespace Is XNamespace.None) Then
Console.WriteLine("Root element is in no namespace")
Else
Console.WriteLine("Root element is in a namespace")
End If
If (root.Element(GetXmlNamespace(aw) + "ChildInNamespace") _
.Name.Namespace Is XNamespace.None) Then
Console.WriteLine("ChildInNamespace element is in no namespace")
Else
Console.WriteLine("ChildInNamespace element is in a namespace")
End If
If (root.Element("ChildInNoNamespace") _
.Name.Namespace Is XNamespace.None) Then
Console.WriteLine("ChildInNoNamespace element is in no namespace")
Else
Console.WriteLine("ChildInNoNamespace element is in a namespace")
End If
End Sub
End Module