I need to load an xml file using vb.net, and replace some values with whatever I need too. Then save this xml file again for further use.
Any tutorial or point in the right direction would be awsome!
Thanks!!
Printable View
I need to load an xml file using vb.net, and replace some values with whatever I need too. Then save this xml file again for further use.
Any tutorial or point in the right direction would be awsome!
Thanks!!
I recommend the use of XPaths to navigate thru the document to update certain record, and use the XmlDocument class a representation of the document.
Plenty of info via Google and MSDN on these.
Great! I figured out though...
how to load the xml document, and I can change Items in the xml as long as i know the index of the item. Using this...
Now how can I have it search that Dataset for a particular string, and then change the value of that string? For example:Code:Private Sub xmlChange()
Dim DS As New DataSet()
DS.ReadXml("c:\inetpub\wwwroot\xmlTest\xmlemp.xml")
DS.Tables(0).Rows(1).Item("Name") = "VALUE TO REPLACE WITH"
DS.WriteXml("c:\inetpub\wwwroot\xmlTest\xmlemp.xml")
End Sub
In my xml, i will have keywords such as %@Prospects% and %@Name% that I want to replace with values, but now can I tell the vb to search for those values instead of me having to know where they are beforehand?
Thanks!