A
A
Airat19952015-06-02 13:56:32
Windows phone
Airat1995, 2015-06-02 13:56:32

How to parse an Html Agility Pack page?

Hello, actually here is the question, how to get the url of the image located on the xpath path //*[@id="dle-content"]/div[1]/div[4]/div[1]/div[2]/ div[1]/img
Using SelectSingleNode does not work, and I have no idea how to get through Descendants. Please help me figure it out.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sivabur, 2015-06-02
@sivabur

HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(Html);
string value=doc.SelectSingleNode("//*[@id='dle-content']/div[1]/div[4]/div[1]/div[2]/div[1]/img").GetAttributeValue("src", "defaul_value");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question