Code example for DOMError

Methods: getLocation, getMessage, getSeverity

0
 * 
 */ 
public class SimpleDOMErrorPrinter implements DOMErrorHandler {
 
    public boolean handleError(DOMError error) {
        String message = error.getMessage();
        Node errorNode = error.getLocation().getRelatedNode();
        short errorType = error.getSeverity();
 
        // Print out error information 
        switch (errorType) {
        case DOMError.SEVERITY_WARNING:
            System.out.print("-->Warning: ");
            break; 
        case DOMError.SEVERITY_ERROR:
            System.out.print("-->Error: ");
            break; 
        case DOMError.SEVERITY_FATAL_ERROR:
            System.out.print("-->Fatal Error: ");
            break; 
        }