如何获取所有<li>
代码?显示的代码只显示1行<li>
标记。
string id="1-1";
public async void ExampLoad(string id)
{
var httpClient = new HttpClient();
string srtHtml = await httpClient.GetStringAsync("http://dictionary.cambridge.org/dictionary/british/appeal");
var htmlDoc = new HtmlDocument();
htmlDoc.LoadHtml(srtHtml);
List<Models.EnglishDictionary> arrays = new List<Models.EnglishDictionary>();
var NewListNodeHtml = htmlDoc.GetElementbyId("entryContent");
if(NewListNodeHtml!=null)
{
var SenseBlock = NewListNodeHtml.Descendants("div").Where(x => x.GetAttributeValue("id", "") == id);
if(SenseBlock!=null)
{
foreach(var node in SenseBlock)
{
Dictionaries = new Models.EnglishDictionary();
var ul = node.Descendants("div").FirstOrDefault(x => x.GetAttributeValue("class", "") == "extraexamps");
if(ul!=null)
{
Dictionaries.Examp = ul.InnerText.Trim();
}
arrays.Add(Dictionaries);
}
}
}
lstExample1_1.ItemsSource = arrays;
}
我发布照片的意义不足。
此处链接照片: