Add a way to validate html pages
Brought to you by:
henryju
This can be useful in order to check the
well-formedness of a page (and some other constaints
like id usage, alt attribute has a value, title has a
value,...).
This feature should be optional (do not enforce the
validation of each "downloaded" pages) but user should
be able to enforce the validation following his needs.
Logged In: YES
user_id=1235926
See http://jtidy.sourceforge.net/
Perhaps could we simply use this lib and check HTML. We need
at least 2 new methods:
assertHtmlIsCorrect() to manually force check
and
setAutoHtmlCheck(boolean value) to set auto assertion.
Unfortunately, the latest version of JTidy is horribly out of date (no new release for 8 years) and the current API is very difficult to work with, so it's probably unlikely that we'll be able to validate newer documents (XHTML, HTML 5) using the current version of JTidy.
Are there any other HTML validation tools for Java?
In the first place, you can simply validate against DTD for XML valid HTML (XHTML). It will not work for old HTML (without closing tags) but who wants to validate a page when code is already ugly.