This was created in VS2008, should work just fine in VS2010.
Create a file called Books.xml in the executable folder.
Add this codeCode:<?xml version="1.0" encoding="utf-8"?> <Root> <Titles> <Title Name="1">I love .NET</Title> <Title Name="2">I Love Delphi</Title> </Titles> </Root>
Code:Private Sub UpdateXmlItem() Dim Doc = XDocument.Load("Books.xml") Dim query = From items In Doc...<Title> Where items.@Name = "2" If query.Value = "Bye Bye Delphi" Then Console.WriteLine("You already said good bye") Else Console.WriteLine(query.Value) query.Value = "Bye Bye Delphi" Console.WriteLine(query.Value) Doc.Save("Books.xml") End If End Sub




Reply With Quote