url = await getstring.GetAsync("http://dictionary.cambridge.org/dictionary/british/"+msg);
htmldocument.LoadHtml(url);
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);
}
}
If retrieved data are Ok but url,vob,word,doc,pra is null then application were broken(break right at url or vob...), I can't check it as if tag.↧
New Post: Why don't I catch be null errors on "div.SelectSingleNode(".//span[@class='pos']").InnerText.Trim(); ".Help me to sovle it.
↧