Try to change relevant part of your code to this :
nodes = root.SelectNodes("//XMLDocument/Books/Book") 'The XMLPath
Me.DataGridView1.Rows.Clear() 'Clear Grid
For Each node In nodes
Me.DataGridView1.Rows.Add(EmptyStringToNull(node("row").GetAttribute("id")),
EmptyStringToNull(node("row")("data_rate_in_as_string").InnerText),
EmptyStringToNull(node("row")("data_rate_out_as_string").InnerText),
EmptyStringToNull(node("row")("downloaded_as_string").InnerText),
EmptyStringToNull(node("row")("elapsed_as_string").InnerText))
Next
Summary of what has been fixed above :
- your XPath shouldn't end with slash (
/
) - node name is "row" instead of "rowid", and you can use
.GetAttribute()
function to get attribute value of anXmlNode
- the rest of elements you're trying to select are child of
<row>
element, hence you need to appendnode("row")
before