https://github.com/dashorst/wicket-stuff-markup-validator
Wicket response filter that validates XHTML markup
https://github.com/dashorst/wicket-stuff-markup-validator
Last synced: 9 months ago
JSON representation
Wicket response filter that validates XHTML markup
- Host: GitHub
- URL: https://github.com/dashorst/wicket-stuff-markup-validator
- Owner: dashorst
- License: apache-2.0
- Created: 2009-02-17T21:38:21.000Z (over 17 years ago)
- Default Branch: master
- Last Pushed: 2022-07-07T23:09:15.000Z (about 4 years ago)
- Last Synced: 2024-04-16T19:33:23.386Z (over 2 years ago)
- Language: Java
- Homepage: http://dashorst.github.com/wicket-stuff-markup-validator
- Size: 2.78 MB
- Stars: 20
- Watchers: 2
- Forks: 7
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Wicket Stuff HTML5 Validator
============================
This project validates the output of your [Apache Wicket](http://wicket.apache.org)
application while running. It includes a error view showing each validation error,
with line-precise error messages.

Validates the following w3c standards:
* HTML 4.01 Strict
* HTML 4.01 Transitional
* XHTML 1.0 Strict
* XHTML 1.0 Transitional
* HTML 5
This project includes the HTML validator taken from [html
validator](http://validator.nu).
Usage
-----
Make sure you use Wicket 6.0.0 or newer. This validator does not run on earlier versions, but is compatible with newer versions. Java 6 is also a minimum requirement.
Add the Wicket Stuff validator to your POM as a dependency:
```xml
org.wicketstuff.htmlvalidator
wicketstuff-htmlvalidator
1.10
```
Depending on your setup you need to use a different `scope` (for example test
or provided to prevent the validator to be deployed to production).
Add the following lines to your `Application`'s init method:
```java
@Override
protected void init() {
super.init();
getMarkupSettings().setStripWicketTags(true);
getRequestCycleSettings().addResponseFilter(new HtmlValidationResponseFilter());
}
```
You might want to put a check for the configuration of your application
around the addition of the response filter, to ensure that the filter doesn't run
in production mode:
```java
if (RuntimeConfigurationType.DEVELOPMENT == getConfigurationType()) {
getRequestCycleSettings().addResponseFilter(new HtmlValidationResponseFilter());
}
```
License
-------
This project is distributed using the Apache 2 License (see LICENSE for more details
on other included software).
Build
-----
Building Wicket.Validator is not difficult: you need to have Java 6 and Maven 3 installed,
and know how to checkout sources from github. Assuming you know how to use Git, you need
to do the following on a command prompt:
```bash
$ git clone git://github.com/dashorst/wicket-stuff-markup-validator.git
$ cd wicket-stuff-markup-validator
$ mvn install
```
Then you can add the Wicket.Validator dependency to your own application using Maven.
Original sources
----------------
Most of the sources come from the htmlvalidator service, which has
its source code published on bitbucket.
Follow the build instructions found here: https://bitbucket.org/validator/build/src
to get all the necessary sources (patched and downloaded) onto your system.
Just make sure that the `checker` folder is next to the clone of the wicket validator folder.
The `whattf` module is derived from the syntax module:
* java code is taken from: https://bitbucket.org/validator/syntax/src/c7989b0788cb/non-schema
* src/main/resources is taken from: https://bitbucket.org/validator/syntax/src/c7989b0788cb73ad916980e122a470d730a51820/relaxng
Retrieve the sources:
hg clone https://bitbucket.org/validator/syntax
Remove the current sources and copy the newly checked out one's:
rm -rf wicketstuff-htmlvalidator-parent/whattf/src/main/java
cp -r checker/syntax/non-schema/java/src wicketstuff-htmlvalidator-parent/whattf/src/main/java
cp -r checker/syntax/relaxng/datatype/java/src/org wicketstuff-htmlvalidator-parent/whattf/src/main/java
cp -r checker/validator/src/nu/validator/localentities wicketstuff-htmlvalidator-parent/whattf/src/main/resources/nu/validator
rm -rf wicketstuff-htmlvalidator-parent/whattf/src/main/resources/relaxng/*
cp checker/syntax/relaxng/* wicketstuff-htmlvalidator-parent/whattf/src/main/resources/relaxng