XNamespace.None Property
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets the XNamespace object that corresponds to no namespace.
Assembly: System.Xml.Linq (in System.Xml.Linq.dll)
The following example shows uses this property to determine which elements are in no namespace.
'add the following line to the the Imports section: 'Imports <xmlns:aw="http://www.adventure-works.com"> Dim output As New StringBuilder Dim root As XElement = _ <Root> <aw:ChildInNamespace>content</aw:ChildInNamespace> <ChildInNoNamespace>content</ChildInNoNamespace> </Root> If (root.Name.Namespace Is XNamespace.None) Then output.Append("Root element is in no namespace") output.Append(Environment.NewLine) Else output.Append("Root element is in a namespace") output.Append(Environment.NewLine) End If If (root.Element(GetXmlNamespace(aw) + "ChildInNamespace") _ .Name.Namespace Is XNamespace.None) Then output.Append("ChildInNamespace element is in no namespace") output.Append(Environment.NewLine) Else output.Append("ChildInNamespace element is in a namespace") output.Append(Environment.NewLine) End If OutputTextBlock.Text = output.ToString()
Show: