I am parsing an XML API response with HTMLAgilityPack. I am able to select the result items from the API call. Then I loop through the items and want to write the ChildNodes to a table. When I select ChildNodes by saying something like:
sItemId = dnItem.ChildNodes(0).innertext
I get the proper itemId result. But when I try:
sItemId = dnItem.ChildNodes("itemId").innertext
I get "Referenced object has a value of 'Nothing'."
I have tried "itemID[1]", "/itemId[1]" and a veriety of strings. I have tried SelectSingleNode and ChildNodes.Item("itemId").innertext. The only one that has worked is using the index.
The problem with using the index is that sometimes child elements are omitted in the results and that throw off the index.
Anybody know what I am doing wrong?