LINQ in Action - LINQ Book & News

VB.NET 9.0 features for XML

Steve Eichert presents in recent blog posts some of the advantages that the next version of VB.NET is going to have for working with XML.

The first feature is named XML Literals. It allows writing templated XML fragments right in your VB code. This makes XML an integral part of the VB.NET language!
The example provided by Steve:
Public Class PurchaseOrder
   Public PODate As Date
   Public Number As String

   Public Function AsXml() As XElement
      Return <purchaseOrder><poNumber date=<%= Me.PODate.ToString() %>><%= Me.Number %></poNumber></purchaseOrder>
   End Function
End Class
Congratulations for the VB code, Steve ;)

The second feature: XML Axis Properties.
This one allows you to use a direct syntax for performing XPath-like queries against XML. For example:
Return rss...<item>(3).@SomeAttribute
These things were in COmega if I remember well, but did not make it to C# :'(
Published Tuesday, July 25, 2006 3:34 PM by Fabrice Marguerie


No Comments
New Comments to this post are disabled