<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Fremus.co.za &#187; Browsers</title>
	<atom:link href="http://www.fremus.co.za/blog/category/web-technologies/browsers/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fremus.co.za/blog</link>
	<description>Demistifying Life and Web Development</description>
	<lastBuildDate>Wed, 08 Sep 2010 18:18:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Interesting code with HtmlAgilityPack</title>
		<link>http://www.fremus.co.za/blog/2009/12/interesting-code-with-htmlagilitypack/</link>
		<comments>http://www.fremus.co.za/blog/2009/12/interesting-code-with-htmlagilitypack/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 12:04:09 +0000</pubDate>
		<dc:creator>fr3dr1k</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[HTML Agility]]></category>

		<guid isPermaLink="false">http://www.fremus.co.za/blog/?p=548</guid>
		<description><![CDATA[Yesterday I was busy with HTML to PDF conversion and for this I used the HTML Agility Pack. Everything worked great, except it seemed IE and FF/Chrome render different HTML. So today I took some fairly straightforward HTML and pushed it through HTMLAgility: New Website Under Construction And if I use this code to loop [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I was busy with HTML to PDF conversion and for this I used the HTML Agility Pack. Everything worked great, except it seemed IE and FF/Chrome render different HTML. So today I took some fairly straightforward HTML and pushed it through HTMLAgility:</p>
<pre name="code" class="html">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>

	<meta name="copyright" content="Copyright (c) 2009 Fredrik Erasmus">
	<meta name="author" content="Fredrik Erasmus">
<link rel="stylesheet" href="css/default.css" type="text/css" media="screen" />
</head>
<body>
<div id="header">
<div id="left_header"></div>
</div>
<div id="container">
<div id="main">
			New Website Under Construction
		</div>
<div id="sidebar">
		</div>
</div>
<div id="footer">
	</div>

</body>
</html>
</pre>
<p>And if I use this code to loop through the childnodes:</p>
<pre name="code" class="csharp">
            HtmlDocument doc = new HtmlDocument();
            string s;
            StringBuilder builder = new StringBuilder();
            using (StreamReader reader = new StreamReader(@"C:\Documents and Settings\user\Desktop\fremus.net\index.htm"))
            {
                while ((s = reader.ReadLine()) != null)
                {
                    builder.AppendLine(s);
                }
            }
            doc.LoadHtml(builder.ToString());
            Console.WriteLine(doc.DocumentNode.ChildNodes.Count);
            foreach (HtmlNode node in doc.DocumentNode.ChildNodes)
            {
                Console.WriteLine(node.Name);
                foreach (HtmlNode childNode in node.ChildNodes)
                {
                    Console.WriteLine("\t\t" + childNode.Name);
                    foreach (HtmlNode grandChildNode in childNode.ChildNodes)
                    {
                        Console.WriteLine("\t\t\t" + grandChildNode.Name);
                    }
                }
            }
</pre>
<p>I get the following result in my command line window:<br />
<a href="http://www.fremus.co.za/blog/wp-content/uploads/2009/12/cmdline.JPG"><img src="http://www.fremus.co.za/blog/wp-content/uploads/2009/12/cmdline.JPG" alt="cmdline" title="cmdline" width="668" height="335" class="alignleft size-full wp-image-549" /></a></p>
<p>As you can see from the output the html node has a text node. The head node has a text node, and it has 9 childnodes including 5 #text nodes. The body node has a text node as well, and it has 7 childnodes, four being #text and the other three being div. So what is this #text node? If you read <a href="http://www.w3schools.com/htmldom/dom_nodes.asp" onclick="urchinTracker('/outgoing/www.w3schools.com/htmldom/dom_nodes.asp?referer=');">this article</a> on the W3C site you will see that it states:</p>
<blockquote><p>A common error in DOM processing is to expect an element node to contain text.</p>
<p>However, the text of an element node is stored in a text node.
</p></blockquote>
<p>On the same page it then gives an example using a title tag. If you do a Google on &#8220;<em>html #text node</em>&#8220;, you will see that the second result points to <a href="http://www.quirksmode.org/dom/intro.html" onclick="urchinTracker('/outgoing/www.quirksmode.org/dom/intro.html?referer=');">an article</a> and if you read the bit on the nodes it seems that each #text node is a child. The #text nodes that appear in the body node seem to point to the text spaces after each div or each element inside the body node. If I change my code slightly:</p>
<pre name="code" class="csharp">
                    Console.WriteLine("\t\t" + childNode.Name);
                    foreach (HtmlNode grandChildNode in childNode.ChildNodes)
                    {
                        Console.WriteLine("\t\t\t" + grandChildNode.Name);
                        Console.WriteLine("\t\t\t\t" + grandChildNode.HasChildNodes);
                    }
</pre>
<p>It tells me that the divs have child elements, but the #text nodes do not. Thus it seems for each &#8216;empty space&#8217; inside a node there exists a #text node. If I amend the HTML from earlier like this:</p>
<pre name="code" class="html">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>

	<meta name="copyright" content="Copyright (c) 2009 Fredrik Erasmus">
	<meta name="author" content="Fredrik Erasmus">
<link rel="stylesheet" href="css/default.css" type="text/css" media="screen" />
</head>
<body>
<div id="footer">

Test
</div>

</body>
</html>
</pre>
<p>Then the footer div will have two text nodes, and the paragraph node will have a textnode. My issues yesterday had to do with the way IE rendered the HTML and that when I used HTMLAgility to parse it, the node counts weren&#8217;t the same. From the sample HTML I have given so far that difference is negligble, but I found that if I went to a site like <a href="http://www.w3schools.com/htmldom/dom_nodes_info.asp" onclick="urchinTracker('/outgoing/www.w3schools.com/htmldom/dom_nodes_info.asp?referer=');">this one</a> and I saved the HTML from IE and Chrome into separate HTML files and I ran my code with that HTML, I got different node counts. Here are two screenshots that illustrate this:<br />
<a href="http://www.fremus.co.za/blog/wp-content/uploads/2009/12/chrome.JPG"><img src="http://www.fremus.co.za/blog/wp-content/uploads/2009/12/chrome.JPG" alt="chrome" title="chrome" width="670" height="338" class="alignleft size-full wp-image-559" /></a><a href="http://www.fremus.co.za/blog/wp-content/uploads/2009/12/ie.JPG"><img src="http://www.fremus.co.za/blog/wp-content/uploads/2009/12/ie.JPG" alt="ie" title="ie" width="666" height="337" class="alignleft size-full wp-image-560" /></a></p>
<p>The first screen is the html from the page saved from chrome and the second one is from ie. Notice the extra text nodes. </p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" onclick="urchinTracker('/outgoing/www.addtoany.com/share_save?referer=');"><img src="http://www.fremus.co.za/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.fremus.co.za/blog/2009/12/interesting-code-with-htmlagilitypack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is Firefox slowly dying?</title>
		<link>http://www.fremus.co.za/blog/2009/10/is-firefox-slowly-dying/</link>
		<comments>http://www.fremus.co.za/blog/2009/10/is-firefox-slowly-dying/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 10:20:38 +0000</pubDate>
		<dc:creator>fr3dr1k</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Internet Explorer]]></category>

		<guid isPermaLink="false">http://www.fremus.co.za/blog/?p=435</guid>
		<description><![CDATA[I mean really, the performance sucks! The Firebug add-on is a 600Kb+ download and it feels as if it really, really slows it down. I have for a while now switched over to Google Chrome, because it is such a fast and responsive browser. I have found one or two issues when using Facebook with [...]]]></description>
			<content:encoded><![CDATA[<p>I mean really, the performance sucks! The Firebug add-on is a 600Kb+ download and it feels as if it really, really slows it down. I have for a while now switched over to Google Chrome, because it is such a fast and responsive browser. I have found one or two issues when using Facebook with Chrome, but other than that its a pretty cool browser. The thing I dislike the most about Firefox is that its process does not terminate completely sometimes, and if you start a new instance of the browser the OS complains that Firefox is still running. Even IE is way quicker than Firefox. I used Firefox for development, and specifically the Firebug and Web Developer plugins, but I have decided to switch over to Chrome, because it does have a developer plugin. IE 8 also has a developer plugin. Thats my two cents for now.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" onclick="urchinTracker('/outgoing/www.addtoany.com/share_save?referer=');"><img src="http://www.fremus.co.za/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.fremus.co.za/blog/2009/10/is-firefox-slowly-dying/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chrome fades as users return to IE, Firefox</title>
		<link>http://www.fremus.co.za/blog/2008/09/chrome-fades-as-users-return-to-ie-firefox/</link>
		<comments>http://www.fremus.co.za/blog/2008/09/chrome-fades-as-users-return-to-ie-firefox/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 10:07:57 +0000</pubDate>
		<dc:creator>fr3dr1k</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[Google Chrome]]></category>

		<guid isPermaLink="false">http://www.fremus.co.za/blog/?p=170</guid>
		<description><![CDATA[So Google released their own browser, Chrome about three weeks ago. As with many things in life if something is interesting and new everybody is likely to have a try, or look at it, but as soon as the shine wears off they will go back to their old habits. The same sentiment holds true [...]]]></description>
			<content:encoded><![CDATA[<p>So Google released their own browser, Chrome about three weeks ago. As with many things in life if something is interesting and new everybody is likely to have a try, or look at it, but as soon as the shine wears off they will go back to their old habits. The same sentiment holds true for Google Chrome, which after its release had about 1% browser share, but now seems to be steadily losing ground and giving share back to Internet Explorer and Firefox. Does this mean that Google will stop the development of Chrome? Will they continue developing it? Was it a flop by Google to build a browser? Only time will tell.</p>
<p>You can read more about this in <a href="http://www.computerworld.com/action/article.do?command=printArticleBasic&#038;taxonomyName=Networking+and+Internet&#038;articleId=9115341&#038;taxonomyId=16" onclick="urchinTracker('/outgoing/www.computerworld.com/action/article.do?command=printArticleBasic_038_taxonomyName=Networking+and+Internet_038_articleId=9115341_038_taxonomyId=16&amp;referer=');">Computer Weekly&#8217;s article.</a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" onclick="urchinTracker('/outgoing/www.addtoany.com/share_save?referer=');"><img src="http://www.fremus.co.za/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.fremus.co.za/blog/2008/09/chrome-fades-as-users-return-to-ie-firefox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How often do you use GMail?</title>
		<link>http://www.fremus.co.za/blog/2008/08/how-often-do-you-use-gmail/</link>
		<comments>http://www.fremus.co.za/blog/2008/08/how-often-do-you-use-gmail/#comments</comments>
		<pubDate>Fri, 15 Aug 2008 14:25:25 +0000</pubDate>
		<dc:creator>fr3dr1k</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Web Technologies]]></category>
		<category><![CDATA[Firefox 3]]></category>
		<category><![CDATA[GMail]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Stylish]]></category>

		<guid isPermaLink="false">http://www.fremus.co.za/blog/?p=90</guid>
		<description><![CDATA[How often do you use GMail? Well, if you use Gmail and you use the web-based version in your browser then you will know how boring the interface can be. With that being said I found Globex Designs and the Stylish Firefox plug in that literally transforms a mundane and boring looking GMail into a [...]]]></description>
			<content:encoded><![CDATA[<p>How often do you use GMail? Well, if you use Gmail and you use the web-based version in your browser then you will know how boring the interface can be. With that being said I found <a href="http://www.globexdesigns.com/gmail/" onclick="urchinTracker('/outgoing/www.globexdesigns.com/gmail/?referer=');">Globex Designs</a> and the <a href="https://addons.mozilla.org/en-US/firefox/addon/2108" onclick="urchinTracker('/outgoing/addons.mozilla.org/en-US/firefox/addon/2108?referer=');">Stylish Firefox plug in</a> that literally transforms a mundane and boring looking GMail into a slick and awesome looking interface. </p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" onclick="urchinTracker('/outgoing/www.addtoany.com/share_save?referer=');"><img src="http://www.fremus.co.za/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.fremus.co.za/blog/2008/08/how-often-do-you-use-gmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>From Flock to Firefox 3</title>
		<link>http://www.fremus.co.za/blog/2008/08/from-flock-to-firefox-3/</link>
		<comments>http://www.fremus.co.za/blog/2008/08/from-flock-to-firefox-3/#comments</comments>
		<pubDate>Thu, 14 Aug 2008 11:51:11 +0000</pubDate>
		<dc:creator>fr3dr1k</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Web Technologies]]></category>
		<category><![CDATA[Firefox 3]]></category>
		<category><![CDATA[Flock]]></category>

		<guid isPermaLink="false">http://www.fremus.co.za/blog/2008/08/from-flock-to-firefox-3/</guid>
		<description><![CDATA[So finally I ditched Flock for Firefox. One of the main reasons I chose to drop Flock was because of Firefox&#8217;s cool address bar, which is better than sliced cheese in my opinion. You simple type in a few words (title tags) and Firefox will take you to that page. Another reason for ditching Flock [...]]]></description>
			<content:encoded><![CDATA[<p>So finally I ditched Flock for Firefox. One of the main reasons I chose to drop Flock was because of Firefox&#8217;s cool address bar, which is better than sliced cheese in my opinion. You simple type in a few words (title tags) and Firefox will take you to that page. Another reason for ditching Flock is the plug-ins that can be used in Firefox. Some of the plugins that I really like using are:</p>
<ul>
<li><a href="http://www.getfirebug.com" onclick="urchinTracker('/outgoing/www.getfirebug.com?referer=');">Firebug:</a>An essential web development tool. It was interesting to note that Brad Abrams from Microsoft used Firebug at Mix Essentials 08.</li>
<li><a href="http://www.kevinfreitas.net/extensions/measureit/" onclick="urchinTracker('/outgoing/www.kevinfreitas.net/extensions/measureit/?referer=');">MeasureIt:</a>A measuring tool is incredibly useful in a web development environment</li>
<li><a href="http://ietab.mozdev.org/" onclick="urchinTracker('/outgoing/ietab.mozdev.org/?referer=');">IE Tab:</a>Unfortunately web developers have to code for audiences that use Internet Explorer but that doesnt mean you have to leave your Firefox abode. This add-on renders pages as Internet Explorer would. You can also change the rendering engine at any given time.</li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" onclick="urchinTracker('/outgoing/www.addtoany.com/share_save?referer=');"><img src="http://www.fremus.co.za/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.fremus.co.za/blog/2008/08/from-flock-to-firefox-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
