VB 9.0 Xml features - Xml namespaces example

VB 9.0 Xml features - Xml namespaces example

  • Comments 3

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

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

Page 1 of 1 (3 items)