Parsing html links by html agility pack in c# -
i'm new in c#. need pars link category , subcategory.
i have category, when try take subcategory have error:
"object reference not set instance of object".
my code:
foreach (var link in xpathlinks) { okno.text += link.attributes["href"].value + "\n"; string doc2 = htmlpage.downloadstring("htmlpage" + link. attributes["href"].value); dokument2.loadhtml(doc2); htmlnodecollection xpathlinks2 = dokument2.documentnode. selectnodes("//ul[@class='category-nav']//li//a"); foreach (var link in xpathlinks2) { okno.text += link.attributes["href"].value + "\n"; } } }
i'm usin htmlagilitypack. error in xpathlinks2.
Comments
Post a Comment