com.crabshue.commons.xml.error.XmlErrorHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-xml Show documentation
Show all versions of commons-xml Show documentation
Library for XML documents operations.
package com.crabshue.commons.xml.error;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/**
* Simple {@link ErrorHandler SAX parsing error handler}, error of the different
* messages treated and throwing the errors.
*
*/
public class XmlErrorHandler implements ErrorHandler {
private static Logger logger = LoggerFactory.getLogger(XmlErrorHandler.class);
@Override
public void warning(final SAXParseException e) throws SAXException {
logger.warn("xml parsing warning", e);
}
@Override
public void error(final SAXParseException e) throws SAXException {
logger.error("xml parsing error", e);
throw e;
}
@Override
public void fatalError(final SAXParseException e) throws SAXException {
logger.error("xml parsing fatal error", e);
throw e;
}
}