I need to get the data out of all of the table cells in the 4th row of the 4th table on an HTML page. After researching for a while, it seems that using DOMXPath is the best way to parse the HTML file. However, no IDs or classes are used anywhere in the file. W开发者_如何学JAVAhat would be the best way to get the data out of these cells?
Thanks in advance.
You can specify an index when fetching with XPath. In your case
/html/body/table[4]/tbody/tr[4]/td
Note that an XPath index is not zero-based, but one-based.
If you are familiar with jQuery syntax, have you looked into phpQuery?
精彩评论