📄 xmlerrorhandler.java
字号:
package com.wiley.compBooks.EJwithUML.BillingSystemInterface;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/**
* This is SAX ErrorHandler. It logs and ignores warnings and errors. It throws
* SAXException for fatal errors.
*/
class XMLErrorHandler implements ErrorHandler
{
/**
* This will report a warning that has occurred; this indicates
* that while no XML rules were broken, something appears
* to be incorrect or missing.
*/
public void warning(SAXParseException exception)
throws SAXException
{
System.out.println("warning()-**Parsing Warning**\n" + " Line: " +
exception.getLineNumber() + "\n" + " URI: " +
exception.getSystemId() + "\n" + " Message: " +
exception.getMessage());
}
/**
* This will report an error that has occurred; this indicates
* that a rule was broken, typically in validation, but that
* parsing can reasonably continue. This is logged and ignored.
*/
public void error(SAXParseException exception)
throws SAXException
{
System.out.println("error()-**Parsing Error**\n" + " Line: " +
exception.getLineNumber() + "\n" + " URI: " +
exception.getSystemId() + "\n" + " Message: " +
exception.getMessage());
}
/**
* This will report a fatal error that has occurred; this indicates
* that a rule has been broken that makes continued parsing either
* impossible or an almost certain waste of time.
*/
public void fatalError(SAXParseException exception)
throws SAXException
{
System.out.println("fatalError()-**Parsing Fatal Error**\n" + " Line: " +
exception.getLineNumber() + "\n" + " URI: " +
exception.getSystemId() + "\n" + " Message: " +
exception.getMessage());
throw new SAXException("Fatal Error encountered");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -