1 package com.thaiopensource.validate.xerces; 2 3 import org.apache.xerces.util.ErrorHandlerWrapper; 4 import org.apache.xerces.xni.parser.XMLParseException; 5 import org.apache.xerces.xni.XNIException; 6 import org.xml.sax.ErrorHandler ; 7 8 class SAXXMLErrorHandler extends ErrorHandlerWrapper { 9 private boolean hadError = false; 10 11 SAXXMLErrorHandler(ErrorHandler errorHandler) { 12 super(errorHandler); 13 } 14 15 void reset() { 16 hadError = false; 17 } 18 19 public void error(String domain, String key, 20 XMLParseException exception) throws XNIException { 21 hadError = true; 22 if (fErrorHandler == null) 23 return; 24 super.error(domain, key, exception); 25 } 26 27 public void warning(String domain, String key, 28 XMLParseException exception) throws XNIException { 29 if (fErrorHandler == null) 30 return; 31 super.warning(domain, key, exception); 32 } 33 34 public void fatalError(String domain, String key, 35 XMLParseException exception) throws XNIException { 36 hadError = true; 37 if (fErrorHandler == null) 38 return; 39 super.fatalError(domain, key, exception); 40 } 41 42 boolean getHadError() { 43 return hadError; 44 } 45 } 46 | Popular Tags |