• 1.3

W3C HTML Java Validator

Validate your HTML against W3C Markup Validation Service with this code.

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 is available for HTML local validation and CSS validation.

All events are logged through slf4j, using "com.jcabi.w3c" logger. If you want to see them, just add proper binding to classpath, as explained in SLF4J manual.