Lazy Diary @ Hatena Blog

PowerShell / Java / miscellaneous things about software development, Tips & Gochas. CC BY-SA 4.0/Apache License 2.0

Functional limitation of The Nu Html Checker (v.Nu)

Problem:

The Nu Html Checker (v.Nu) is useful HTML validator. It can be used not only from a web browser, but also from command line. But, this validator has some functional limitations (for both web interface and CLI version).

  • v.Nu cannot handle non-Unicode files. For example, you will get errors like below for Shift_JIS files:
~/download/dist$ java -jar vnu.jar sjis.html 
"file:/home/satob/download/dist/sjis.html":11.40-11.40: error: Malformed byte sequence: “83”.
"file:/home/satob/download/dist/sjis.html":11.42-11.42: error: Malformed byte sequence: “81”.
"file:/home/satob/download/dist/sjis.html":11.44-11.44: error: Malformed byte sequence: “83”.
  • v.Nu treats an HTML 4.01 doctype as obsolete doctype and shows an error:
~/download/dist$ java -jar vnu.jar html4.html
"file:/home/satob/download/dist/index.html":1.1-3.44: info warning: Obsolete doctype. Expected “<!DOCTYPE html>”.
  • Partial HTML (often used for Single Page Applications) gets error:
~/download/dist$ java -jar vnu.jar partial.html 
"file:/home/satob/download/dist/partial.html":1.1-1.19: error: Start tag seen without seeing a doctype first. Expected “<!DOCTYPE html>”.
  • Custom attributes (and tags) for JavaScript frameworks are treated as invalidate attribute:
~/download/dist$ java -jar vnu.jar angular.html 
"file:/home/satob/download/dist/angular.html":9.1-9.15: error: Attribute “ng-app” not allowed on element “div” at this point.
"file:/home/satob/download/dist/angular.html":12.10-12.44: error: Attribute “ng-model” not allowed on element “input” at this point.
"file:/home/satob/download/dist/angular.html":13.1-13.18: error: Attribute “ng-bind” not allowed on element “p” at this point.

In other words, v.Nu can handle only UTF-8 encoded, HTML5, full-length, and plain HTML.

Reason:

It seems by design.

Solution:

v.Nu doesn’t have options for these valid-depending-on-context HTML. There is no workaround for this problem, so use another HTML validator.

For example, The Eclipse built-in HTML validator can handle non-Unicode files, HTML 4.01, partial HTML, and has option for non-standard tags and attributes.