I am using HTMLAGility Pack to parse HTML file as I want to access attributes of DIVS in HTML.
Following my code
HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();
htmlDoc.Load("C:\\sampleHtml.html");
var divs = htmlDoc.DocumentNode.SelectNodes("//div");
List<Feature> pageTitles = new List<Feature>();
foreach (var div in divs)
{
pageTitles.Add(new Feature(Convert.ToInt32(div.Id), div.Name.ToString(), false, false));
}
This is my HTML
<div id="101" isEnabled="0">My Binders<br />
<img align="" width="170" vspace="0" hspace="0" height="113" border="0" alt="" src="http://www.obout.com/editor_new/images/Nature/field_from_woods.jpg" title="" /><br />
<div id="111" isEnabled="0">Share Binders<br />
<img align="" width="170" vspace="0" hspace="0" height="114" border="0" alt="" src="http://www.obout.com/editor_new/images/Nature/meadow_cows.jpg" title="" /><br />
</div>
<div id="123" isEnabled="0">Add Binders<br />
<img align="" width="48" vspace="0" hspace="0" height="48" border="0" alt="" src="http://www.obout.com/editor_new/images/flags/shadow/flag_american_samoa.png" title="" /><br />
</div></div>
I have a "IsEnabled" property for each div. But, I am not able to access the value of this property using HTMLAgile pack. How can this be achieved.
Thanks