Basically I'm trying to read settings from a XML file but I have all the nodes the same name that I'm using so I have to assign them ID's but how do I go about getting the node from the attribute ID and writing to that node I have just found
Here is what I have:
Public Sub write_xml_file(ByVal path As String, ByVal nodePath As String, ByVal innerText As String)
If IO.File.Exists(path) = True Then
' Load the XmlDocument.
Dim xd As New XmlDocument()
xd.Load(path)
Dim node As XmlNodeList = xd.SelectNodes(nodePath)
If node IsNot Nothing Then
Dim nodeId As Integer = 0
For Each childNode As XmlElement In node
MessageBox.Show(get_node_count(node))
If childNode("p").InnerText = "" Then
MessageBox.Show("Found empty...")
Exit For
Else
MessageBox.Show("Empty place not found, carry on looking...")
nodeId += 1
Continue For
End If
Next
End If
MessageBox.Show("Finished")
' Save the Xml.
xd.Save(path)
Else
MessageBox.Show("Could not write to selected path: " + path)
End If
End Sub
As you can see all I am doing is just getting the first node from the list without getting the node with attribute 1, 2, 3 etc. I just cant figure out how to get this and then use it to edit the node.