我有一个包含XHTML表格的XmlDocument。我想循环遍历它,以便逐行处理表格单元格,但是下面的代码返回嵌套循环中的所有单元格,而不仅仅是当前行的单元格:
XmlNodeList tableRows = xdoc.SelectNodes("//tr");
foreach (XmlElement tableRow in tableRows)
{
XmlNodeList tableCells = tableRow.SelectNodes("//td");
foreach (XmlElement tableCell in tableCells)
{
// this loops through all the table cells in the XmlDocument,
// instead of just the table cells in the current row
}
}
我做错了什么?谢谢