All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.crabshue.commons.xml.error.XmlErrorHandler Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy