1 38 package com.gargoylesoftware.htmlunit.html; 39 40 import java.net.URL ; 41 42 import org.apache.commons.logging.Log; 43 import org.apache.commons.logging.LogFactory; 44 45 54 public interface HTMLParserListener { 55 56 61 HTMLParserListener LOG_REPORTER = new HTMLParserListener() 62 { 63 protected final Log getLog() { 64 return LogFactory.getLog(HTMLParserListener.class); 65 } 66 public void error(final String message, final URL url, final int line, final int column, final String key) 67 { 68 getLog().error(format(message, url, line, column, key)); 69 } 70 public void warning(final String message, final URL url, final int line, final int column, final String key) 71 { 72 getLog().warn(format(message, url, line, column, key)); 73 } 74 private String format(final String message, final URL url, final int line, final int column, final String key) { 75 final StringBuffer buffer = new StringBuffer (message); 76 buffer.append(" ("); 77 buffer.append(url.toExternalForm()); 78 buffer.append(" "); 79 buffer.append(line); 80 buffer.append(":"); 81 buffer.append(column); 82 buffer.append(")"); 83 return buffer.toString(); 84 } 85 }; 86 87 95 void error(final String message, final URL url, final int line, final int column, final String key); 96 97 105 void warning(final String message, final URL url, final int line, final int column, final String key); 106 } 107 | Popular Tags |