Code example for DOMError

Methods: getLocation, getMessage, getSeverity

0
	/* (non-Javadoc) 
	 * @see org.w3c.dom.DOMErrorHandler#handleError(org.w3c.dom.DOMError) 
	 */ 
	@Override 
	public boolean handleError(DOMError error) {
		int severity = error.getSeverity();
		if (severity == DOMError.SEVERITY_FATAL_ERROR) {
			logger.severe("[xs-fatal-error]: " + errorMessage(error));
			System.exit(1);
		} else if (severity == DOMError.SEVERITY_ERROR) {
			logger.severe("[xs-error]: " + errorMessage(error));
		} else if (severity == DOMError.SEVERITY_WARNING) {
			logger.warning("[xs-warning]: " + errorMessage(error));
		} 
		return true; 
	} 
 
	/** 
	 * @param error 
	 * @return 
	 */ 
	private String errorMessage(DOMError error) {
		return error.getMessage() + " (line: " + error.getLocation().getLineNumber() + ")";
	} 
}