Java Reference
In-Depth Information
quired interface and respond to SAX parsing events as they occur. Example 6-19 shows a
simple handler implementation.
Example6-19.Validation handler implementation
import com.sun.xml.ws.developer.ValidationErrorHandler;
import org.xml.sax.SAXParseException;
import org.xml.sax.SAXException;
import org.apache.log4j.Logger;
/**
* The error handler that catches validation problems against
* the schema.
*
* @author ehewitt
* @author bmericle
*/
public final class SigCapClientValidationHandler
extends ValidationErrorHandler {
private static final Logger LOGGER =
Logger.getLogger(SigCapClientValidationHandler.class);
public SigCapClientValidationHandler() {
LOGGER.debug("Schema Validation Handler created.");
}
@Override
public void warning(final SAXParseException e) throws SAXException {
LOGGER.warn("Schema Validation Warning: " +
e.getLocalizedMessage());
// Store warnings in the packet so that they can be retrieved
//from the endpoint
packet.invocationProperties.put("Schema Validation Warning.",
e);
throw e;
}
@Override
public void error(final SAXParseException e) throws SAXException {
LOGGER.error("Schema Validation Error: " +
e.getLocalizedMessage());
throw e;
}
@Override
public void fatalError(final SAXParseException e) throws
Search WWH ::




Custom Search