I tried to validate my HTML5 document against the Nu RNC set available in github.com/validator/validator/tree/master/schema/html using jing, I ended up with "datatype library "http://whattf.org/datatype-draft not recognized" error. I am not sure what is the error all about. Is it not possible to validate the HTML5 using this RNC set in jing?
1 Answers
Maintainer of the https://github.com/validator/validator/tree/master/schema/html5 schema here.
That schema’s not really meant for use outside the context of the Nu Html Checker. Among other things, it relies on a datatype library—set of Java classes—we don’t package/distribute separately.
The lack of it in your classpath causes the “Datatype library… not recognized” error you cite. For it to work, in your classpath you need to have a jar file with those classes and a special manifest.
We do distribute a jar file that contains those, but with a lot of other things too—the jar is 22MB. You can get that (zipped) jar from here:
https://github.com/validator/validator/releases/download/17.3.0/vnu.jar_17.3.0.zip
Once you unzip that, you’ll have a local vnu.jar
file, which you can use like this:
java -cp vnu.jar com.thaiopensource.relaxng.util.Driver \
-c https://raw.github.com/validator/validator/master/schema/html5/xhtml5.rnc \
FILE.xhtml
Of course if you have a local clone of the https://github.com/validator/validator repo, then you can replace https://raw.github.com/validator/validator/master/schema/html5/xhtml5.rnc with the filesystem path to the local copy of that xhtml5.rnc
file.

- 81,827
- 26
- 193
- 197
-
Hi, I was trying to compile the jar file from the cloned copy of validator https://github.com/validator/validator with the local copy of html.rnc. But I am getting the error Could not find or load main class org.apache.tools.ant.Main. Is there any way to handle the data types in RNC which are used in datatype.jar ? – VSe Aug 01 '17 at 11:13
-
The ant classes are in jar files in the `jing-trang/lib` directory. If you build the validator jar by running `./build/build.sh update dldeps build jar` the build script finds the dependency jars on its own and uses them in its build classpath. – sideshowbarker Aug 01 '17 at 12:21
-
Thank you! I can build Jar, but while testing it getting `Could not find or load main class nu.validator.client.SimpleCommandLineValidator` I can't use that Jar to run in command line `java -jar vnu.jar File.html` – VSe Aug 02 '17 at 06:52
-
Probably best to post a new question at this point, or actually better yet to open a new issue at https://github.com/validator/validator/issues. Please show the exact command you’re running, along with exactly how you built the jar – sideshowbarker Aug 02 '17 at 06:55