[html5] Using validator.nu as a standalone library

Henri Sivonen hsivonen at iki.fi
Fri Apr 29 05:23:34 PDT 2011


Hi,

On Thu, 2011-04-21 at 17:34 -0700, Trubin, Stanislav wrote:
> I am trying to build an offline solution to provide HTML4/5 validation
> with as little dependencies as possible. I got stuck creating a basic
> Java application that would use validator.nu’s core as a standalone
> library. I would greatly appreciate any help in providing code
> examples that would help creating such application.

Currently, the best code example is
https://bitbucket.org/validator/validator/src/05607e55502f/src/nu/validator/servlet/VerifierServletTransaction.java

> I get a few basic errors back (such as un-escaped ampersand character
> in the URL), but nothing HTML-specific (for instance, “Attribute
> height not allowed on element tr at this point.”)

The parser alone only tells you about what the spec calls "parse
errors". The parser alone doesn't perform full validation.

Unfortunately, the validator isn't currently packaged as a standalone
library. The path of least modification to get there would be
implementing your own HttpServletRequest and HttpServletResponse objects
that you could pass to VerifierServletTransaction so that it would think
it lives inside a servlet environment even if it doesn't.

-- 
Henri Sivonen
hsivonen at iki.fi
http://hsivonen.iki.fi/




More information about the Help mailing list