package hibergui.generator.tool.xml;

import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;

/**
 * Class implements ErrorHandler. Its methods handle different
 * errors which can be occured while processing XML document.
 * 
 * @author Csaba Gyenge
 */
class XMLErrorHandler implements ErrorHandler {

	/**
	 * Throws fatal errors
	 */
	public void fatalError(SAXParseException e) throws SAXException {
		System.out.println("Fatal error at line " + e.getLineNumber() + ": " + e.getMessage());
		throw e;
	}
	
	/**
	 * Show errors in xml
	 */
	public void error(SAXParseException e) throws SAXParseException {
		System.out.println("Error at line " + e.getLineNumber() + ": " + e.getMessage());
		throw e;
	}

	/**
	 * Show warning messages 
	 */
	public void warning(SAXParseException e) throws SAXParseException{
		System.out.println("Warning at line " + e.getLineNumber() + ": " + e.getMessage());
		throw e;
	}
}
