本文介绍了检查SelectSingleNode时,错误为null并且borken up。帮我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
var doc = htmldocument.DocumentNode.SelectNodes("//div[starts-with(@class, 'sense-block')]");
foreach (var div in doc)
{
Assets.Dictionary Dic = new Assets.Dictionary();
string vob = div.SelectSingleNode(".//span[@class='hw']").ToString();
string word = div.SelectSingleNode(".//span[@class='pos']").InnerText.Trim();
string pra = div.SelectSingleNode(".//span[@class='guideword']").InnerText.Trim();
if(vob==null && worb==null && pra==null)
{
Dic.Example = div.SelectSingleNode(".//span[@class='def-block']").InnerText.Trim();
Dic.Explaining = div.SelectSingleNode(".//span[@class='def']").InnerText.Trim();
Lst.Add(Dic);
}
}
该计划在这里被打破
That program was be broken right here
string vob = div.SelectSingleNode(".//span[@class='hw']").ToString();
下面不能保留步骤
Can't keeps next below steps
推荐答案
这篇关于检查SelectSingleNode时,错误为null并且borken up。帮我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!