07-May-2013 0.4.12
W3C Validator in Java
It's simple (see JavaDoc for more details):
public class My {
public void main() {
String xhtml = "<html><body><p>Hello, world!</p></body></html>";
ValidationResponse response = new ValidatorBuilder().html().validate(xhtml);
assert response.valid();
}
}Similar mechanism for CSS:
public class My {
public void main() {
String css = "body { font-family: Arial; }";
ValidationResponse response = new ValidatorBuilder().css().validate(css);
assert response.valid();
}
}This dependency you add to pom.xml (or download rexsl-w3c.jar):
<dependency> <groupId>com.rexsl</groupId> <artifactId>rexsl-w3c</artifactId> <version>0.4.12</version> </dependency>
All events are logged through slf4j, using "com.rexsl.w3c" logger. If you want to see them, just add proper binding to classpath, as explained in SLF4J manual.
Copyright © 2011-2013 ReXSL.com, All Rights Reserved. Privacy Policy.