这段代码给我一个奇怪的异常。Node "<span class="OrganisationOut"></span>" was not found in the collection
但是当我检查 span 的 outerHTML 时,它的<span class="OrganisationOut">National Cheng Kung University</span>
. 为什么它试图删除不同的跨度?
doc = web.Load(urlTeams);
foreach (HtmlNode node in doc.DocumentNode.SelectNodes("//tr[contains(@id,'Cell')]"))
{
HtmlNode span = node.SelectSingleNode(".//span");
lbResults2.Items.Add(span.InnerText);
lbResults.Items.Add(node.RemoveChild(span).InnerText.Trim());
}