我有一个问题dt,dd从打击 HTML 表中选择所有
<dl class="Grid Grid--multicol Grid--2col:40em Grid--4col:60em">
<div class="Grid-cell u-flex u-flexOne u-flexRow">
<dt> Item ID:</dt>
<dd class="u-weightSemibold u-paddingL5px">72547664</dd>
</div>
<div class="Grid-cell u-flex u-flexOne u-flexRow">
<dt> License:</dt>
<dd class="u-weightSemibold u-paddingL5px">
<a class="u-linkDodgerBlue js-infoLicenseString" href="" target="_blank">Standard</a>
</dd>
</div>
<div class="Grid-cell u-flex u-flexOne u-flexRow">
<dt> Usage:</dt>
<dd class="u-weightSemibold">Commercial<span class="TooltipQuestionMark"></span></dd>
</div>
<div class="Grid-cell u-flex u-flexOne u-flexRow">
<dt> Required Plugins:</dt>
<dd class="u-weightSemibold u-paddingL5px">None</dd>
</div>
<div class="Grid-cell u-flex u-flexOne u-flexRow">
<dt> Creation Tool:</dt>
<dd class="u-weightSemibold u-paddingL5px">Autodesk</dd>
</div>
<div class="Grid-cell u-flex u-flexOne u-isHidden:0-60em"></div>
</dl>
我写这个
i = 0; doc.DocumentNode.SelectNodes("//dl").Where(x => x.HasClass("Grid")).FirstOrDefault().SelectNodes(".//div").ToList().ForEach(x =>
{
result.Items.Add(new DownloadItem { Name = "specs-title", Index = i, Type = DownloadItemType.Text, Value = x.SelectNodes(".//dt").FirstOrDefault().GetText() });
result.Items.Add(new DownloadItem { Name = "specs", Index = i++, Type = DownloadItemType.Text, Value = x.SelectNodes(".//dd").GetText() });
});
上面的代码只是抓取第一行 Item ID:| 72547664 什么我的问题,列出所有dt与dd信息
鸿蒙传说
相关分类