문제

As you see in the picture an item has subitems which are <th> and <td>. When I query item to get <td>, it returns null. Here is the code: item.SelectSingleNode("td") Shouldn't it get td node? (http://i.stack.imgur.com/EXu7W.png)

enter image description here

도움이 되었습니까?

해결책

It seems that <td> isn't direct child of current item. To select descendant that isn't direct child you can use double slashes (//) :

item.SelectSingleNode(".//td")

And if I see it correctly, <td> is child of <th>, so you can also do this way :

item.SelectSingleNode("th/td")
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top