It gets even better. Again, beginning with Visual Basic 2008, you can create documents that work with XDocument and XElement objects directly in code. These inline XML documents are called XML literals. The following example shows how this works:
Dim fleet As XElement = <fleet> <licensePlate>MS - VB 2010</licensePlate> <load amount="10 Tons">Salt</load> <manufacturer>Mack</manufacturer> </fleet>
The fleet object is a simple Xelement. You can add the modelYear element as usual:
fleet.Add(New XElement("modelYear", 1998))
And it’s even easier with XML literals:
Inline XML documents don’t need to be completely static; they can include dynamic ...