Get All Elements In A Nodecollections
I have an html file :
Solution 1:
When you are querying over some node you don't need
//at the beginning, if you are adding it query will be executed over whole document.You need to take first node after selecting, so you need to take node with index
0not1
This 2 points will solve your problem, but there are some improvements you can do
- Instead of
SelecNodes().First()you can userSelectSingleNode() - If you don't need any information about parent nodes you can directly query
for child nodes -
htmlDocument.SelectNodes("\\span[@class='time']")will do all the work
Post a Comment for "Get All Elements In A Nodecollections"