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.
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.
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.
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.
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).
You can use the W3C validator directly from Java, see w3c-jabi.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With