<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: C# Parsing HTML with HtmlAgilityPack</title>
	<atom:link href="http://kossovsky.net/index.php/2009/07/csharp-html-parser-htmlagilitypack/feed/" rel="self" type="application/rss+xml" />
	<link>http://kossovsky.net/index.php/2009/07/csharp-html-parser-htmlagilitypack/</link>
	<description>C# Code Snippets, ASP.NET Code Samples, .NET Tips and Tricks</description>
	<lastBuildDate>Tue, 31 Jan 2012 06:04:50 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
	<item>
		<title>By: Raj</title>
		<link>http://kossovsky.net/index.php/2009/07/csharp-html-parser-htmlagilitypack/comment-page-1/#comment-18359</link>
		<dc:creator>Raj</dc:creator>
		<pubDate>Mon, 10 Oct 2011 06:38:38 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=508#comment-18359</guid>
		<description>Hi,
I had tried the following code but it has not not worked, seems it is not supported full Xpath, please check and let me know if I am doing any thing wrong:

        static void Main(string[] args)
        {
            HtmlAgilityPack.HtmlWeb web = new HtmlWeb();
            HtmlAgilityPack.HtmlDocument doc = web.Load(&quot;http://www.google.com&quot;);
            //doc.DocumentNode.SelectSingleNode(&quot;//*[@id=\&quot;lst-ib\&quot;]&quot;);//(&quot;/html/body/div[2]/form/div/div[2]/table/tbody/tr/td/table/tbody/tr/td/div/table/tbody/tr/td/table/tbody/tr/td[2]/div/input&quot;);
            //System.Console.WriteLine(doc.DocumentNode.SelectSingleNode(&quot;//*[@id=\&quot;lst-ib\&quot;]&quot;).Id);
            foreach (HtmlNode link in doc.DocumentNode.SelectNodes(&quot;/html/body/div[2]/form/div&quot;))
            {
                HtmlAttribute att = link.Attributes[&quot;id&quot;];

                System.Console.Write(att.Value);

            }
            System.Console.ReadKey();

        }</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I had tried the following code but it has not not worked, seems it is not supported full Xpath, please check and let me know if I am doing any thing wrong:</p>
<p>        static void Main(string[] args)<br />
        {<br />
            HtmlAgilityPack.HtmlWeb web = new HtmlWeb();<br />
            HtmlAgilityPack.HtmlDocument doc = web.Load(&#8220;http://www.google.com&#8221;);<br />
            //doc.DocumentNode.SelectSingleNode(&#8220;//*[@id=\"lst-ib\"]&#8220;);//(&#8220;/html/body/div[2]/form/div/div[2]/table/tbody/tr/td/table/tbody/tr/td/div/table/tbody/tr/td/table/tbody/tr/td[2]/div/input&#8221;);<br />
            //System.Console.WriteLine(doc.DocumentNode.SelectSingleNode(&#8220;//*[@id=\"lst-ib\"]&#8220;).Id);<br />
            foreach (HtmlNode link in doc.DocumentNode.SelectNodes(&#8220;/html/body/div[2]/form/div&#8221;))<br />
            {<br />
                HtmlAttribute att = link.Attributes["id"];</p>
<p>                System.Console.Write(att.Value);</p>
<p>            }<br />
            System.Console.ReadKey();</p>
<p>        }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JIBIN</title>
		<link>http://kossovsky.net/index.php/2009/07/csharp-html-parser-htmlagilitypack/comment-page-1/#comment-12050</link>
		<dc:creator>JIBIN</dc:creator>
		<pubDate>Wed, 13 Jul 2011 05:58:49 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=508#comment-12050</guid>
		<description>Hi , how can i avoid the presence of specila characters using htmlagility pack, 
Say If the actual  innertext of a tag contain $12.34 , but the result of html agility pack innertext shows $12.34 (Means $ in place for $.). How can i avoid this .
I want to get the exact text as it is shown  in browser</description>
		<content:encoded><![CDATA[<p>Hi , how can i avoid the presence of specila characters using htmlagility pack,<br />
Say If the actual  innertext of a tag contain $12.34 , but the result of html agility pack innertext shows $12.34 (Means $ in place for $.). How can i avoid this .<br />
I want to get the exact text as it is shown  in browser</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: miri</title>
		<link>http://kossovsky.net/index.php/2009/07/csharp-html-parser-htmlagilitypack/comment-page-1/#comment-7316</link>
		<dc:creator>miri</dc:creator>
		<pubDate>Wed, 27 Apr 2011 10:27:32 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=508#comment-7316</guid>
		<description>Why do I get a NullReferenceException?
I&#039;m still not convinced.</description>
		<content:encoded><![CDATA[<p>Why do I get a NullReferenceException?<br />
I&#8217;m still not convinced.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kamal Deep Singh</title>
		<link>http://kossovsky.net/index.php/2009/07/csharp-html-parser-htmlagilitypack/comment-page-1/#comment-6671</link>
		<dc:creator>Kamal Deep Singh</dc:creator>
		<pubDate>Sat, 19 Mar 2011 06:34:27 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=508#comment-6671</guid>
		<description>Awesome Work</description>
		<content:encoded><![CDATA[<p>Awesome Work</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tips &#171; dfang&#039;s Weblog</title>
		<link>http://kossovsky.net/index.php/2009/07/csharp-html-parser-htmlagilitypack/comment-page-1/#comment-6237</link>
		<dc:creator>tips &#171; dfang&#039;s Weblog</dc:creator>
		<pubDate>Fri, 11 Feb 2011 02:38:31 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=508#comment-6237</guid>
		<description>[...] find all images without an “alt” attribute, add it and resave the Html document. [...]</description>
		<content:encoded><![CDATA[<div style="color:#008200">
<p>[...] find all images without an “alt” attribute, add it and resave the Html document. [...]</p>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aditya</title>
		<link>http://kossovsky.net/index.php/2009/07/csharp-html-parser-htmlagilitypack/comment-page-1/#comment-3880</link>
		<dc:creator>Aditya</dc:creator>
		<pubDate>Wed, 19 May 2010 11:18:09 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=508#comment-3880</guid>
		<description>Thanks for your sugestion....</description>
		<content:encoded><![CDATA[<p>Thanks for your sugestion&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xander</title>
		<link>http://kossovsky.net/index.php/2009/07/csharp-html-parser-htmlagilitypack/comment-page-1/#comment-3876</link>
		<dc:creator>Xander</dc:creator>
		<pubDate>Tue, 18 May 2010 16:05:19 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=508#comment-3876</guid>
		<description>&lt;a href=&quot;#comment-3873&quot; rel=&quot;nofollow&quot;&gt;@Aditya &lt;/a&gt;, I don&#039;t thinks you should load any remote HTML using the Agility Pack. Use &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx&quot; target=&quot;_blank&quot; title=&quot;MSDN HttpWebRequest Class&quot; rel=&quot;nofollow&quot;&gt;HttpWebRequest Class&lt;/a&gt; to get the url content and then parse it with Agility Pack.</description>
		<content:encoded><![CDATA[<p><a href="#comment-3873" rel="nofollow">@Aditya </a>, I don&#8217;t thinks you should load any remote HTML using the Agility Pack. Use <a href="http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx" target="_blank" title="MSDN HttpWebRequest Class" rel="nofollow">HttpWebRequest Class</a> to get the url content and then parse it with Agility Pack.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aditya</title>
		<link>http://kossovsky.net/index.php/2009/07/csharp-html-parser-htmlagilitypack/comment-page-1/#comment-3873</link>
		<dc:creator>Aditya</dc:creator>
		<pubDate>Tue, 18 May 2010 09:14:11 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=508#comment-3873</guid>
		<description>HTML agility pack is really a good option. 
But how to handle request timeout is challenge. I havnt found with HTML Agility pack can you suggest any idea........</description>
		<content:encoded><![CDATA[<p>HTML agility pack is really a good option.<br />
But how to handle request timeout is challenge. I havnt found with HTML Agility pack can you suggest any idea&#8230;&#8230;..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xander</title>
		<link>http://kossovsky.net/index.php/2009/07/csharp-html-parser-htmlagilitypack/comment-page-1/#comment-3410</link>
		<dc:creator>Xander</dc:creator>
		<pubDate>Mon, 15 Mar 2010 16:36:30 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=508#comment-3410</guid>
		<description>&lt;a href=&quot;#comment-3380&quot; rel=&quot;nofollow&quot;&gt;@Bill  &lt;/a&gt; 
Hi, Bill

Use : doc.DocumentNode.SelectNodes(&quot;//form[@id=&#039;form2&#039;]/input&quot;), but don&#039;t forget to check if the result isn&#039;t null before executing foreach</description>
		<content:encoded><![CDATA[<p><a href="#comment-3380" rel="nofollow">@Bill  </a><br />
Hi, Bill</p>
<p>Use : doc.DocumentNode.SelectNodes(&#8220;//form[@id='form2']/input&#8221;), but don&#8217;t forget to check if the result isn&#8217;t null before executing foreach</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill</title>
		<link>http://kossovsky.net/index.php/2009/07/csharp-html-parser-htmlagilitypack/comment-page-1/#comment-3380</link>
		<dc:creator>Bill</dc:creator>
		<pubDate>Fri, 05 Mar 2010 09:40:54 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=508#comment-3380</guid>
		<description>How to get all input elements in form2 of below html file?

  
    
      
      &lt;!-- Other elements --&gt;
    
    
      
      &lt;!-- Other elements --&gt;
    
  


I tried:
            HtmlDocument doc = new HtmlDocument();
            doc.Load(@&quot;D:\test.html&quot;);

            foreach (HtmlNode node in doc.GetElementbyId(&quot;form2&quot;).SelectNodes(&quot;.//input&quot;))
            {
                Console.WriteLine(node.Attributes[&quot;value&quot;].Value);            
            }

But no luck. 
Anything I did wrong?</description>
		<content:encoded><![CDATA[<p>How to get all input elements in form2 of below html file?</p>
<p>      <!-- Other elements --></p>
<p>      <!-- Other elements --></p>
<p>I tried:<br />
            HtmlDocument doc = new HtmlDocument();<br />
            doc.Load(@&#8221;D:\test.html&#8221;);</p>
<p>            foreach (HtmlNode node in doc.GetElementbyId(&#8220;form2&#8243;).SelectNodes(&#8220;.//input&#8221;))<br />
            {<br />
                Console.WriteLine(node.Attributes["value"].Value);<br />
            }</p>
<p>But no luck.<br />
Anything I did wrong?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

