Skip to content Skip to sidebar Skip to footer

Html Agility Pack Selectsinglenode Giving Always Same Result In Iteration?

I would like the nodes in the collection but with iterating SelectSingleNode I keep getting the same object just node.Id is changing... What i try is to readout the webresponse of

Solution 1:

By writing

node.SelectSingleNode("//span[@itemprop='name']").InnerText

it's like you writing

doc.DocumentNode.SelectSingleNode("//span[@itemprop='name']").InnerText

To do what you want to do you should write it like this: node.SelectSingleNode(".//span[@itemprop='name']").InnerText.

This .dot / period tells make a search on the current node which is node instead on doc

Post a Comment for "Html Agility Pack Selectsinglenode Giving Always Same Result In Iteration?"