To create or change an XML structure in Microsoft Visual Basic 2005 and earlier versions required significant developer efforts. For example, here’s what you had to do to extend the following XML structure that saves vehicle data by adding a modelYear element:
<fleet>
<licensePlate>MS - VB 2010</licensePlate>
<load amount="10 Tons">Salt</load>
<manufacturer>Mack</manufacturer>
<modelYear>1998</modelYear>
</fleet>
In Visual Basic 2005, the code is:
Dim xml As New XmlDocument xml.Load(Application.StartupPath + "\fleet1.xml") Dim nodeList As XmlNodeList = xml.GetElementsByTagName("fleet") 'In case there are more: loop For Each node As XmlNode In nodeList Dim xmlElement As XmlElement = xml.CreateElement("modelYear") ...
No credit card required