VB 9.0 Xml features – Xml namespaces example


Bill McCarthy asked me to post Xml axis members example using namespaces. So I updated the sample from my previous post as follows:


 


I added an imports statement for Xml namespace:


Imports ns = “http://someNamespace”


 


I also update my xml document to include namespaces:


Dim Person = _


<ns:Person ns:Dept=SQL Server xmlns:ns=http://someNamespace>


            <ns:Name>Erik Meijer</ns:Name>


</ns:Person>


 


Finally, I updated the code that uses the new syntax for Xml axis members:


      Console.WriteLine(Person.<ns:Name>.Value)


      Console.WriteLine(Person.@ns:Dept.Value)


      Person.<ns:Name>.Value = “Mike Champion”


      Console.WriteLine(Person.<ns:Name>.Value)


 


This code produces the following output:


Erik Meijer


SQL Server


Mike Champion


 


 


Avner Aharoni


Comments (3)

  1. By Amanda Silver

    &amp;nbsp;

    &amp;nbsp;I just wanted to let you know that we’re working furiously on turning…

  2. @ Head says:

    Erik Meijer and Brian Beckman have put out a new paper on XML and LINQ and VB.&#160; It’s a good short read…

  3. By Amanda Silver I just wanted to let you know that we’re working furiously on turning the VB9 features

Skip to main content