Code example for SAXParseException

Methods: getCause, getColumnNumber, getLineNumber, getLocalizedMessage, getMessage, getPublicId, getSystemId, toString

0
		throw ex;
	} 
 
	@Override 
	public void fatalError(final SAXParseException ex) throws SAXException {
		System.err.println("XML-FATAL: " + getInputSource(ex) + ", line " + ex.getLineNumber() + ", column " + ex.getColumnNumber() + ":");
		System.err.println(ex.toString());
		throw ex;
	} 
 
	@Override 
	public void warning(final SAXParseException ex) throws SAXException {
		System.err.println("XML-WARNING: " + getInputSource(ex) + ", line " + ex.getLineNumber() + ", column " + ex.getColumnNumber() + ":");
		System.err.println(ex.getMessage());
	} 
 
	private String getInputSource(final SAXParseException ex) {
		System.out.println(ex.getPublicId());
		System.out.println(ex.getSystemId());
		System.out.println(ex.getCause());
		System.out.println(ex.getLocalizedMessage());
		System.out.println(ex.getMessage());
		if (ex.getSystemId() != null) {
			return ex.getSystemId();
		} 
		else if (ex.getPublicId() != null) {
			return ex.getPublicId();
		} 
		//try to use the locally stored inputSource 
		return this.source;
	}