Partager via


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 = "https://someNamespace"

 

I also update my xml document to include namespaces:

Dim Person = _

<ns:Person ns:Dept="SQL Server" xmlns:ns="https://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

  • Anonymous
    March 16, 2006
    By Amanda Silver
    &amp;nbsp;
    &amp;nbsp;I just wanted to let you know that we’re working furiously on turning...
  • Anonymous
    April 07, 2006
    Erik Meijer and Brian Beckman have put out a new paper on XML and LINQ and VB.&#160; It's a good short read...
  • Anonymous
    March 10, 2007
    By Amanda Silver I just wanted to let you know that we’re working furiously on turning the VB9 features