Frage

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

War es hilfreich?

Lösung

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")
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top