Hello all, I thought I posted this once... but I can''t find it in my mailbox ? *shrug* Would there be a way to perform W3C XHTML validation against my pages via functional test ? I would like to validate that way to ensure that my partials contain compliant snippets. Thanks ! Peter Fitzgibbons _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Here''s where I first described how to do it:
http://scottraymond.net/articles/2005/09/20/rails-xhtml-validation
And here''s a more terse version that will summarize validation errors
in the Test::Unit output:
def assert_valid_markup(fragment=-sVi5de4ipzRvjmmFUwpDsA@public.gmane.org)
require ''net/http''
response =
Net::HTTP.start(''validator.w3.org'').post2(''/check'',
"fragment=#{CGI.escape(fragment)}&output=xml")
assert_equal ''200'', response.code, "W3C validator
service error"
markup_is_valid =
response[''x-w3c-validator-status'']==''Valid''
message = markup_is_valid ? '''' :
XmlSimple.xml_in(response.body)[''messages''][0][''msg''].collect{
|m|
"Invalid markup: line #{m[''line'']}:
#{CGI.unescapeHTML(m[''content''])}"
}.join("\n")
assert markup_is_valid, message
end
:sco
Peter Fitzgibbons
<peter.fitzgibbons-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Would there be a way to perform W3C XHTML validation against my pages via
> functional test ?
>
> I would like to validate that way to ensure that my partials contain
> compliant snippets.
On 10/10/05, Peter Fitzgibbons <peter.fitzgibbons-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello all, > > I thought I posted this once... but I can''t find it in my mailbox ? *shrug* > > Would there be a way to perform W3C XHTML validation against my pages via > functional test ? > > I would like to validate that way to ensure that my partials contain > compliant snippets.You''d probably want to run the html against something like http://www.htmlhelp.com/tools/validator/offline/index.html.en
Peter, I think this is what you are looking for. http://scottraymond.net/articles/2005/09/20/rails-xhtml-validation On Oct 10, 2005, at 10:46 AM, Peter Fitzgibbons wrote:> Hello all, > > I thought I posted this once... but I can''t find it in my mailbox ? > *shrug* > > Would there be a way to perform W3C XHTML validation against my > pages via functional test ? > > I would like to validate that way to ensure that my partials > contain compliant snippets. > > Thanks ! > > Peter Fitzgibbons > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >