Is there any functionality in Html Agility Pack SelectSingleNode
to let me search similiar IDs?
Looking for something like
string str = node.SelectSingleNode("//td[@id **contains** 'id_']/span/text()")
.InnerText;
or
string str = node.SelectSingleNode("//td[@id **startsWith** 'id_']/span/text()")
.InnerText;
There are XPath functions contains()
and starts-with()
, exactly as you wish. Example usage of those functions :
string str1 = node.SelectSingleNode("//td[contains(@id, 'id_')]/span/text()")
.InnerText;
string str2 = node.SelectSingleNode("//td[starts-with(@id, 'id_')]/span/text()")
.InnerText;