From AppleScripts by Tom X:
Safari Web Site Validator: Opens a new window in Safari and sends the HTML or XHTML code of the web page you're viewing to W3C Markup Validation Service. It then opens a second window to validate the CSS code. W3C will display any errors it can detect in the HTML/XHTML and CSS code. I included two scripts in the folder. The script named 'Safari Web Site Validator Go' does the same thing as 'Safari Web Site Validator' except there isn't a dialog box when you launch it. This might prove convenient (and faster) for those of you who have many pages that you want to validate.