> It would be pretty easy to take what I've done and make it into a > general purpose <htmlvalidate> task and even have it fail the build if > errors are detected if thats what you want.
Thanks, very simple indeed. Unfortunately Tidy isn't quite as strict as the CSE HTML Validator, but hey, it's free... import java.io.*; import java.net.*; import org.apache.tools.ant.*; import org.w3c.tidy.Tidy; public class TidyTask extends Task { private String url; public void setUrl(String url) { this.url = url; } public void execute() throws BuildException { try { log("Validating: " + url); Tidy tidy = new Tidy(); tidy.setQuiet(true); InputStream in = open(); tidy.parse(in, null); in.close(); } catch (IOException e) { throw new BuildException(e); } } private InputStream open() throws IOException { HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) throw new BuildException("Couldn't retrieve '" + url + "': " + connection.getResponseMessage()); return connection.getInputStream(); } } -- Eric Jain -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>