<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Adding HTML validity checking to your ASP.NET web site via unit tests</title>
	<atom:link href="http://damianedwards.wordpress.com/2008/10/06/adding-html-validity-checking-to-your-aspnet-web-site-via-unit-tests/feed/" rel="self" type="application/rss+xml" />
	<link>http://damianedwards.wordpress.com/2008/10/06/adding-html-validity-checking-to-your-aspnet-web-site-via-unit-tests/</link>
	<description>Thoughts on web standards, ASP.NET and team development - Damian Edwards</description>
	<lastBuildDate>Thu, 31 Dec 2009 22:53:21 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jim Lamb : Building a simple web site with VSTS/TFS 2008</title>
		<link>http://damianedwards.wordpress.com/2008/10/06/adding-html-validity-checking-to-your-aspnet-web-site-via-unit-tests/#comment-88</link>
		<dc:creator>Jim Lamb : Building a simple web site with VSTS/TFS 2008</dc:creator>
		<pubDate>Fri, 17 Apr 2009 04:47:58 +0000</pubDate>
		<guid isPermaLink="false">http://damianedwards.wordpress.com/2008/10/06/adding-html-validity-checking-to-your-aspnet-web-site-via-unit-tests/#comment-88</guid>
		<description>[...] page in the site using the W3C Markup Validation Service (inspired by Damian Edwards’ excellent Adding HTML validity checking to your ASP.net web site via unit tests post). Over the course of building this web site, I learned a lot about what you can and can’t do [...]</description>
		<content:encoded><![CDATA[<p>[...] page in the site using the W3C Markup Validation Service (inspired by Damian Edwards’ excellent Adding HTML validity checking to your ASP.net web site via unit tests post). Over the course of building this web site, I learned a lot about what you can and can’t do [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jens&#8217;s Codelog &#187; HTML, CSS and RSS validity unit-test (java)</title>
		<link>http://damianedwards.wordpress.com/2008/10/06/adding-html-validity-checking-to-your-aspnet-web-site-via-unit-tests/#comment-87</link>
		<dc:creator>Jens&#8217;s Codelog &#187; HTML, CSS and RSS validity unit-test (java)</dc:creator>
		<pubDate>Thu, 16 Apr 2009 20:36:29 +0000</pubDate>
		<guid isPermaLink="false">http://damianedwards.wordpress.com/2008/10/06/adding-html-validity-checking-to-your-aspnet-web-site-via-unit-tests/#comment-87</guid>
		<description>[...] had this exact problem and solved it’. I put my googles on and found that indeed someone had for dot net.. I needed the same test for a java based project and thus wrote [...]</description>
		<content:encoded><![CDATA[<p>[...] had this exact problem and solved it’. I put my googles on and found that indeed someone had for dot net.. I needed the same test for a java based project and thus wrote [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Max Design - standards based web design, development and training &#187; Some links for light reading (14/10/08)</title>
		<link>http://damianedwards.wordpress.com/2008/10/06/adding-html-validity-checking-to-your-aspnet-web-site-via-unit-tests/#comment-8</link>
		<dc:creator>Max Design - standards based web design, development and training &#187; Some links for light reading (14/10/08)</dc:creator>
		<pubDate>Tue, 14 Oct 2008 09:46:14 +0000</pubDate>
		<guid isPermaLink="false">http://damianedwards.wordpress.com/2008/10/06/adding-html-validity-checking-to-your-aspnet-web-site-via-unit-tests/#comment-8</guid>
		<description>[...] Adding HTML validity checking to your ASP.NET web site via unit tests [...]</description>
		<content:encoded><![CDATA[<p>[...] Adding HTML validity checking to your ASP.NET web site via unit tests [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jens</title>
		<link>http://damianedwards.wordpress.com/2008/10/06/adding-html-validity-checking-to-your-aspnet-web-site-via-unit-tests/#comment-5</link>
		<dc:creator>jens</dc:creator>
		<pubDate>Tue, 07 Oct 2008 16:22:12 +0000</pubDate>
		<guid isPermaLink="false">http://damianedwards.wordpress.com/2008/10/06/adding-html-validity-checking-to-your-aspnet-web-site-via-unit-tests/#comment-5</guid>
		<description>Hi,

Great job!
Here&#039;s an equivalent in java using jUnit4 and hamcrest for validation:


public class W3CValidityCheckerIntTest {

    private final String OUR_URL = &quot;http://localhost:8080/&quot;;
    private final String VALIDATOR_URL = &quot;http://validator.w3.org/check&quot;;

    @Test
    public void testValidity() throws Exception {

        URLConnection our_url = (new URL(OUR_URL)).openConnection();
        BufferedReader br = new BufferedReader(new InputStreamReader(our_url.getInputStream()));
        String l;
        StringBuffer buff = new StringBuffer();
        while((l = br.readLine()) != null) {
            buff.append(l).append(&quot;\n&quot;);
        }

        String data = URLEncoder.encode(&quot;fragment&quot;, &quot;UTF-8&quot;) + &quot;=&quot; + URLEncoder.encode(buff.toString(), &quot;UTF-8&quot;);
        data += &quot;&amp;&quot; + URLEncoder.encode(&quot;prefill&quot;, &quot;UTF-8&quot;) + &quot;=&quot; + URLEncoder.encode(&quot;0&quot;, &quot;UTF-8&quot;);
        data += &quot;&amp;&quot; + URLEncoder.encode(&quot;group&quot;, &quot;UTF-8&quot;) + &quot;=&quot; + URLEncoder.encode(&quot;0&quot;, &quot;UTF-8&quot;);
        data += &quot;&amp;&quot; + URLEncoder.encode(&quot;doctype&quot;, &quot;UTF-8&quot;) + &quot;=&quot; + URLEncoder.encode(&quot;Inline&quot;, &quot;UTF-8&quot;);

        URL url = new URL(VALIDATOR_URL);
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();

        conn.setDoOutput(true);
        conn.setDoInput(true);
        conn.setRequestMethod(&quot;POST&quot;);

        OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
        wr.write(data);
        wr.flush();

        String valid = conn.getHeaderField(&quot;X-W3C-Validator-Status&quot;);
        System.out.println(&quot;Warnings: &quot; + conn.getHeaderField(&quot;X-W3C-Validator-Warnings&quot;));
        System.out.println(&quot;Errors: &quot; + conn.getHeaderField(&quot;X-W3C-Validator-Errors&quot;));
        System.out.println(&quot;Status: &quot; + valid);

        BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String line;
        while ((line = rd.readLine()) != null) {
            System.out.println(&quot;line: &quot; + line);
        }
        wr.close();
        rd.close();

        boolean is_valid = (!valid.equalsIgnoreCase(&quot;invalid&quot;));
        assertThat(&quot;The page is valid&quot;, is_valid, is(true));
    }
}</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Great job!<br />
Here&#8217;s an equivalent in java using jUnit4 and hamcrest for validation:</p>
<p>public class W3CValidityCheckerIntTest {</p>
<p>    private final String OUR_URL = &#8220;http://localhost:8080/&#8221;;<br />
    private final String VALIDATOR_URL = &#8220;http://validator.w3.org/check&#8221;;</p>
<p>    @Test<br />
    public void testValidity() throws Exception {</p>
<p>        URLConnection our_url = (new URL(OUR_URL)).openConnection();<br />
        BufferedReader br = new BufferedReader(new InputStreamReader(our_url.getInputStream()));<br />
        String l;<br />
        StringBuffer buff = new StringBuffer();<br />
        while((l = br.readLine()) != null) {<br />
            buff.append(l).append(&#8220;\n&#8221;);<br />
        }</p>
<p>        String data = URLEncoder.encode(&#8220;fragment&#8221;, &#8220;UTF-8&#8243;) + &#8220;=&#8221; + URLEncoder.encode(buff.toString(), &#8220;UTF-8&#8243;);<br />
        data += &#8220;&amp;&#8221; + URLEncoder.encode(&#8220;prefill&#8221;, &#8220;UTF-8&#8243;) + &#8220;=&#8221; + URLEncoder.encode(&#8220;0&#8243;, &#8220;UTF-8&#8243;);<br />
        data += &#8220;&amp;&#8221; + URLEncoder.encode(&#8220;group&#8221;, &#8220;UTF-8&#8243;) + &#8220;=&#8221; + URLEncoder.encode(&#8220;0&#8243;, &#8220;UTF-8&#8243;);<br />
        data += &#8220;&amp;&#8221; + URLEncoder.encode(&#8220;doctype&#8221;, &#8220;UTF-8&#8243;) + &#8220;=&#8221; + URLEncoder.encode(&#8220;Inline&#8221;, &#8220;UTF-8&#8243;);</p>
<p>        URL url = new URL(VALIDATOR_URL);<br />
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();</p>
<p>        conn.setDoOutput(true);<br />
        conn.setDoInput(true);<br />
        conn.setRequestMethod(&#8220;POST&#8221;);</p>
<p>        OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());<br />
        wr.write(data);<br />
        wr.flush();</p>
<p>        String valid = conn.getHeaderField(&#8220;X-W3C-Validator-Status&#8221;);<br />
        System.out.println(&#8220;Warnings: &#8221; + conn.getHeaderField(&#8220;X-W3C-Validator-Warnings&#8221;));<br />
        System.out.println(&#8220;Errors: &#8221; + conn.getHeaderField(&#8220;X-W3C-Validator-Errors&#8221;));<br />
        System.out.println(&#8220;Status: &#8221; + valid);</p>
<p>        BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));<br />
        String line;<br />
        while ((line = rd.readLine()) != null) {<br />
            System.out.println(&#8220;line: &#8221; + line);<br />
        }<br />
        wr.close();<br />
        rd.close();</p>
<p>        boolean is_valid = (!valid.equalsIgnoreCase(&#8220;invalid&#8221;));<br />
        assertThat(&#8220;The page is valid&#8221;, is_valid, is(true));<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>
