المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : nested HTML table and xpath: matching level one child node (without hardcoding entire xpath using single forward slashes)



C# Programming
05-26-2012, 10:11 AM
hi, this is a nested HTML table. Using Xpath .//table//tr we can retrieve all table rows. That's what double forward slashes does for you (matches not only level one beaneath current node but also any sub level deeper in the hierarchy).

What I want to achieve is to be able to retrieve first-level table rows only but WITHOUT hardcoding path using single forward slash:
.//table/tr
As we can, possibly, have tag sitting beneath tag but about , in which case above xpath will miss!

Many thanks



Sample page






Name
John Doe


Tel
416-987-1234






EmpID
12345


Salary
75000









dev