1 16 19 package servlet; 20 21 import java.io.*; 22 import org.xml.sax.*; 23 import org.apache.xml.utils.DefaultErrorHandler; 24 25 35 36 public class ApplyXSLTListener extends DefaultErrorHandler implements ErrorHandler 37 { 38 39 42 private ByteArrayOutputStream outStream = new ByteArrayOutputStream(); 43 44 47 public PrintWriter out = null; 48 49 52 public ApplyXSLTListener() 53 { 54 out = new PrintWriter(new BufferedOutputStream(outStream), true); 55 } 56 57 62 public void warning(SAXParseException spe) 63 { 64 out.println("Parser Warning: " + spe.getMessage()); 65 } 66 67 72 public void error(SAXParseException spe) 73 { 74 out.println("Parser Error: " + spe.getMessage()); 75 } 76 77 83 public void fatalError(SAXParseException spe) 84 throws SAXException 85 { 86 out.println("Parser Fatal Error: " + spe.getMessage()); 87 throw spe; 88 } 89 90 94 public String getMessage() 95 { 96 return outStream.toString(); 97 } 98 } 99 100 | Popular Tags |