title: Can I configure JTidy to ignore certain errors and warnings?
body: <p>I am using JTidy to validate snippets of HTML generated in Java a rendering class. I would like to ignore certain warnings <strike>and errors</strike>.</p>
  
  <p>(EDIT: On second thoughts I might not want to suppress <strong>errors</strong>)</p>
  
  <p>For example, the following snippet that is generated:</p>
  
  <pre><code>&lt;img src='/images/icon.gif'&gt;
  </code></pre>
  
  <p>results in this warning:</p>
  
  <p><code>line 5 column 7 - Warning: img lacks "alt" attribute</code></p>
  
  <p>Can I configure JTidy to ignore specific checks such as this one?</p>
  
  <p>The method I use to check is:</p>
  
  <pre><code>public static boolean isValidHtml(String htmlSnippet) {
      String untestedHtml = "&lt;!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"&gt;&lt;HTML&gt;" +
              "&lt;head&gt;&lt;title&gt;Wrapper HTML For Testing&lt;/title&gt;&lt;/head&gt;" +
              htmlSnippet +
              "&lt;/HTML&gt;";
  
      final Tidy tidy = new Tidy();
      final Writer writer = new StringWriter();
      tidy.setErrout(new PrintWriter(writer, true));
  
      tidy.parseDOM(new StringReader(untestedHtml), writer);
  
      if (tidy.getParseErrors() &gt; 0 || tidy.getParseWarnings() &gt; 0) {
          System.err.println(writer);
          return false;
      }
      return true;
  }
  </code></pre>