Best code examples for Java 8 DOMError class (org.w3c.dom.DOMError)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 DOMError class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Java 8 DOMError examples from Open Source projects
This code example shows how to use the following methods: getMessage, getRelatedData, getRelatedException, getSeverity, getType
     * 
     */ 
    public boolean handleError(DOMError error) {
        boolean fail = true;
        String severity = null;
        if (error.getSeverity() == DOMError.SEVERITY_WARNING) {
            fail = false;
            severity = "[Warning]";
        } else if (error.getSeverity() == DOMError.SEVERITY_ERROR) {
            severity = "[Error]";
        } else if (error.getSeverity() == DOMError.SEVERITY_FATAL_ERROR) {
            severity = "[Fatal Error]";
        } 
         
        System.err.println(severity + ": " + error.getMessage() + "\t");
        System.err.println("Type : " + error.getType() + "\t" + "Related Data: "
                + error.getRelatedData() + "\t" + "Related Exception: "
                + error.getRelatedException() );
         
        return fail;

7
CodeRank
This code example shows how to use the following methods: getMessage, getRelatedData, getRelatedException, getSeverity, getType
     * 
     */ 
    public boolean handleError(DOMError error) {
        boolean fail = true;
        String severity = null;
        if (error.getSeverity() == DOMError.SEVERITY_WARNING) {
            fail = false;
            severity = "[Warning]";
        } else if (error.getSeverity() == DOMError.SEVERITY_ERROR) {
            severity = "[Error]";
        } else if (error.getSeverity() == DOMError.SEVERITY_FATAL_ERROR) {
            severity = "[Fatal Error]";
        } 
         
        System.err.println(severity + ": " + error.getMessage() + "\t");
        System.err.println("Type : " + error.getType() + "\t" + "Related Data: "
                + error.getRelatedData() + "\t" + "Related Exception: "
                + error.getRelatedException() );
         
        return fail;

7
CodeRank
This code example shows how to use the following methods: getMessage, getRelatedData, getRelatedException, getSeverity, getType
     * 
     */ 
    public boolean handleError(DOMError error) {
        boolean fail = true;
        String severity = null;
        if (error.getSeverity() == DOMError.SEVERITY_WARNING) {
            fail = false;
            severity = "[Warning]";
        } else if (error.getSeverity() == DOMError.SEVERITY_ERROR) {
            severity = "[Error]";
        } else if (error.getSeverity() == DOMError.SEVERITY_FATAL_ERROR) {
            severity = "[Fatal Error]";
        } 
         
        System.err.println(severity + ": " + error.getMessage() + "\t");
        System.err.println("Type : " + error.getType() + "\t" + "Related Data: "
                + error.getRelatedData() + "\t" + "Related Exception: "
                + error.getRelatedException() );
         
        return fail;

6
CodeRank
This code example shows how to use the following methods: getLocation, getMessage, getSeverity
 * 
 */ 
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; 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getLocation, getMessage, getSeverity
	/* (non-Javadoc) 
	 * @see org.w3c.dom.DOMErrorHandler#handleError(org.w3c.dom.DOMError) 
	 */ 
	@Override 
	public boolean handleError(DOMError error) {
		int severity = error.getSeverity();
		if (severity == DOMError.SEVERITY_FATAL_ERROR) {
			logger.severe("[xs-fatal-error]: " + errorMessage(error));
			System.exit(1);
		} else if (severity == DOMError.SEVERITY_ERROR) {
			logger.severe("[xs-error]: " + errorMessage(error));
		} else if (severity == DOMError.SEVERITY_WARNING) {
			logger.warning("[xs-warning]: " + errorMessage(error));
		} 
		return true; 
	} 
 
	/** 
	 * @param error 
	 * @return 

5
CodeRank
See Code Examples for Java 8 DOMError Methods: