This repository provides several validation checks on both the structure of the XHTML files and the data inside the files. This is more than just a schema validator.
It checks the correctness of values in the XHTML file: e.g. id="..." attributes are unique, internal links actually point to somewhere in the document.
It will also check that the structure of the XHTML is correct. Self-closing tags are a problem for HTML parsers so we aim to generate XHTML that can also be parsed by HTML parsers. Self-closing spans, links, headings are particular culprits.
This performs the following validations:
Mount a volume and specify the path to the XHTML file as the argument.
# Clone this repo and run:
docker run --volume $(pwd):/data --rm -it $(docker build -q .) /data/test/resources/fail-duplicate.xhtml
docker run --volume $(pwd):/data --rm -it $(docker build -q .) /data/test/resources/fail-no-link-target.xhtml
docker run --volume $(pwd):/data --rm -it $(docker build -q .) /data/test/resources/pass.xhtml
docker run --volume $(pwd):/data --rm -it $(docker build -q .) /data/test/resources/fail-link-to-duplicate-id.xhtml link-to-duplicate-id
An additional optional argument specifies which test to run:
A full build (including generation of .jar and running unit tests) can be invoked using the build gradle task:
./gradlew build
Build artifacts will be generated in ./build, and xhtml-validator.jar can be found in ./build/libs/.
The unit tests can be run using the test task:
./gradlew test
The environment can be cleaned up using the clean task:
./gradlew clean
Content type
Image
Digest
Size
64.6 MB
Last updated
over 4 years ago
docker pull openstax/xhtml-validator:20220118.185647