Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to validate that HTML matches W3C standards

I have a project that generates HTML pages using a Velocity template and Java. But most of the pages do not comply with W3C standards. How can I validate those HTML pages and get a log telling me what errors/warnings on what pages?

Then I can fix the errors manually. I have tried JTidyFilter, but that doesn't work for me.

like image 918
newguy Avatar asked Jun 23 '10 00:06

newguy


People also ask

How do you validate W3C standards?

The best way to validate your code is by using the W3C validation tools. CSS Validator: This validator checks the CSS validity of web documents in HTML, XHTML etc. There are plenty of browser extensions that will test the page you're viewing against the W3C validators.

What is W3C HTML Validator?

The Markup Validation Service is a validator by the World Wide Web Consortium (W3C) that allows Internet users to check pre-HTML5 HTML and XHTML documents for well-formed markup against a document type definition. Markup validation is an important step towards ensuring the technical quality of web pages.

How do you determine whether your HTML document conforms to web standards?

The best way to validate your code is by using the W3C validation tools. This validator checks the markup validity of web documents in HTML, XHTML, SMIL, MathML, etc. This validator checks the CSS validity of web documents in HTML, XHTML etc.

How do I validate my HTML code?

In order to validate your code, you have to declare the standard to which it adheres. To describe the HTML standard (the document type declaration, DTD), the file should contain a DOCTYPE declaration (before the HTML code). Here are a few examples (from http://www.htmlhelp.com/tools/validator/doctype.html).


1 Answers

You can use the W3C validator directly from Java, see w3c-jabi.

like image 150
yegor256 Avatar answered Sep 30 '22 22:09

yegor256