📄 simpleerrorhandler.java
字号:
/* * SimpleErrorHandler.java * * Created on January 8, 2004, 12:08 PM */package cs101.xml;import org.xml.sax.SAXException;import org.xml.sax.ErrorHandler;import org.xml.sax.SAXParseException;/** * A blindingly simple and completely unforgiving xml ErrorHandler. * It is only suitable for use when all errors and warnings have the * same meaning. All methods in this class will do nothing but * rethrow the supplied SAXParseException as a SAXException with a message * indicating which method was called. While the message could be parsed * to determine which type of error was produced, it is probably better * to extend this class and overide the methods you want to distingush * or implement your own error handler. * * @author Patrick G. Heck @, gus.heck@olin.edu */public class SimpleErrorHandler implements ErrorHandler { public static final String ERROR = "Parser Error!"; public static final String FATAL_ERROR = "Parser Fatal Error!"; public static final String WARNING = "Parser Warning!"; /** Creates a new instance of SimpleErrorHandler */ public SimpleErrorHandler() { } public void error(SAXParseException spe) throws SAXException { throw new SAXException(ERROR, spe); } public void fatalError(SAXParseException spe) throws SAXException { throw new SAXException(FATAL_ERROR, spe); } public void warning(SAXParseException spe) throws SAXException { throw new SAXException(WARNING, spe); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -