Java Code Examples for org.w3c.dom.DOMError#getSeverity()
The following examples show how to use
org.w3c.dom.DOMError#getSeverity() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DOMErrorHandlerImpl.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Implementation of DOMErrorHandler.handleError that * adds copy of error to list for later retrieval. * */ 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; }
Example 2
Source File: DOMErrorHandlerImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Implementation of DOMErrorHandler.handleError that * adds copy of error to list for later retrieval. * */ 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; }
Example 3
Source File: DOMErrorHandlerImpl.java From j2objc with Apache License 2.0 | 6 votes |
/** * Implementation of DOMErrorHandler.handleError that * adds copy of error to list for later retrieval. * */ 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; }
Example 4
Source File: DOMConfigurationTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public boolean handleError(DOMError error) { if (error.getSeverity() == DOMError.SEVERITY_ERROR) { this.error = "" + error.getMessage(); return false; } if (error.getSeverity() == DOMError.SEVERITY_FATAL_ERROR) { this.fatalError = "" + error.getMessage(); return false; } this.warning = "" + error.getMessage(); return true; // warning }
Example 5
Source File: DOMConfigurationTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public boolean handleError(DOMError error) { if (error.getSeverity() == DOMError.SEVERITY_ERROR) { Assert.fail("Error: " + error.getMessage()); } if (error.getSeverity() == DOMError.SEVERITY_FATAL_ERROR) { Assert.fail("Fatal error: " + error.getMessage()); } return true; // warning }
Example 6
Source File: DOMErrorHandlerWrapper.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
/** Prints the error message. */ private void printError(DOMError error) { int severity = error.getSeverity(); fOut.print("["); if ( severity == DOMError.SEVERITY_WARNING) { fOut.print("Warning"); } else if ( severity == DOMError.SEVERITY_ERROR) { fOut.print("Error"); } else { fOut.print("FatalError"); eStatus = false ; //REVISIT: Abort processing if fatal error, do we need to?? } fOut.print("] "); DOMLocator locator = error.getLocation(); if (locator != null) { fOut.print(locator.getLineNumber()); fOut.print(":"); fOut.print(locator.getColumnNumber()); fOut.print(":"); fOut.print(locator.getByteOffset()); fOut.print(","); fOut.print(locator.getUtf16Offset()); Node node = locator.getRelatedNode(); if (node != null) { fOut.print("["); fOut.print(node.getNodeName()); fOut.print("]"); } String systemId = locator.getUri(); if (systemId != null) { int index = systemId.lastIndexOf('/'); if (index != -1) systemId = systemId.substring(index + 1); fOut.print(": "); fOut.print(systemId); } } fOut.print(":"); fOut.print(error.getMessage()); fOut.println(); fOut.flush(); }
Example 7
Source File: DOMErrorHandlerWrapper.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** Prints the error message. */ private void printError(DOMError error) { int severity = error.getSeverity(); fOut.print("["); if ( severity == DOMError.SEVERITY_WARNING) { fOut.print("Warning"); } else if ( severity == DOMError.SEVERITY_ERROR) { fOut.print("Error"); } else { fOut.print("FatalError"); eStatus = false ; //REVISIT: Abort processing if fatal error, do we need to?? } fOut.print("] "); DOMLocator locator = error.getLocation(); if (locator != null) { fOut.print(locator.getLineNumber()); fOut.print(":"); fOut.print(locator.getColumnNumber()); fOut.print(":"); fOut.print(locator.getByteOffset()); fOut.print(","); fOut.print(locator.getUtf16Offset()); Node node = locator.getRelatedNode(); if (node != null) { fOut.print("["); fOut.print(node.getNodeName()); fOut.print("]"); } String systemId = locator.getUri(); if (systemId != null) { int index = systemId.lastIndexOf('/'); if (index != -1) systemId = systemId.substring(index + 1); fOut.print(": "); fOut.print(systemId); } } fOut.print(":"); fOut.print(error.getMessage()); fOut.println(); fOut.flush(); }
Example 8
Source File: DOMErrorHandlerWrapper.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** Prints the error message. */ private void printError(DOMError error) { int severity = error.getSeverity(); fOut.print("["); if ( severity == DOMError.SEVERITY_WARNING) { fOut.print("Warning"); } else if ( severity == DOMError.SEVERITY_ERROR) { fOut.print("Error"); } else { fOut.print("FatalError"); eStatus = false ; //REVISIT: Abort processing if fatal error, do we need to?? } fOut.print("] "); DOMLocator locator = error.getLocation(); if (locator != null) { fOut.print(locator.getLineNumber()); fOut.print(":"); fOut.print(locator.getColumnNumber()); fOut.print(":"); fOut.print(locator.getByteOffset()); fOut.print(","); fOut.print(locator.getUtf16Offset()); Node node = locator.getRelatedNode(); if (node != null) { fOut.print("["); fOut.print(node.getNodeName()); fOut.print("]"); } String systemId = locator.getUri(); if (systemId != null) { int index = systemId.lastIndexOf('/'); if (index != -1) systemId = systemId.substring(index + 1); fOut.print(": "); fOut.print(systemId); } } fOut.print(":"); fOut.print(error.getMessage()); fOut.println(); fOut.flush(); }
Example 9
Source File: DOMErrorHandlerWrapper.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** Prints the error message. */ private void printError(DOMError error) { int severity = error.getSeverity(); fOut.print("["); if ( severity == DOMError.SEVERITY_WARNING) { fOut.print("Warning"); } else if ( severity == DOMError.SEVERITY_ERROR) { fOut.print("Error"); } else { fOut.print("FatalError"); eStatus = false ; //REVISIT: Abort processing if fatal error, do we need to?? } fOut.print("] "); DOMLocator locator = error.getLocation(); if (locator != null) { fOut.print(locator.getLineNumber()); fOut.print(":"); fOut.print(locator.getColumnNumber()); fOut.print(":"); fOut.print(locator.getByteOffset()); fOut.print(","); fOut.print(locator.getUtf16Offset()); Node node = locator.getRelatedNode(); if (node != null) { fOut.print("["); fOut.print(node.getNodeName()); fOut.print("]"); } String systemId = locator.getUri(); if (systemId != null) { int index = systemId.lastIndexOf('/'); if (index != -1) systemId = systemId.substring(index + 1); fOut.print(": "); fOut.print(systemId); } } fOut.print(":"); fOut.print(error.getMessage()); fOut.println(); fOut.flush(); }
Example 10
Source File: DOMErrorHandlerWrapper.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** Prints the error message. */ private void printError(DOMError error) { int severity = error.getSeverity(); fOut.print("["); if ( severity == DOMError.SEVERITY_WARNING) { fOut.print("Warning"); } else if ( severity == DOMError.SEVERITY_ERROR) { fOut.print("Error"); } else { fOut.print("FatalError"); eStatus = false ; //REVISIT: Abort processing if fatal error, do we need to?? } fOut.print("] "); DOMLocator locator = error.getLocation(); if (locator != null) { fOut.print(locator.getLineNumber()); fOut.print(":"); fOut.print(locator.getColumnNumber()); fOut.print(":"); fOut.print(locator.getByteOffset()); fOut.print(","); fOut.print(locator.getUtf16Offset()); Node node = locator.getRelatedNode(); if (node != null) { fOut.print("["); fOut.print(node.getNodeName()); fOut.print("]"); } String systemId = locator.getUri(); if (systemId != null) { int index = systemId.lastIndexOf('/'); if (index != -1) systemId = systemId.substring(index + 1); fOut.print(": "); fOut.print(systemId); } } fOut.print(":"); fOut.print(error.getMessage()); fOut.println(); fOut.flush(); }
Example 11
Source File: DOMErrorHandlerWrapper.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** Prints the error message. */ private void printError(DOMError error) { int severity = error.getSeverity(); fOut.print("["); if ( severity == DOMError.SEVERITY_WARNING) { fOut.print("Warning"); } else if ( severity == DOMError.SEVERITY_ERROR) { fOut.print("Error"); } else { fOut.print("FatalError"); eStatus = false ; //REVISIT: Abort processing if fatal error, do we need to?? } fOut.print("] "); DOMLocator locator = error.getLocation(); if (locator != null) { fOut.print(locator.getLineNumber()); fOut.print(":"); fOut.print(locator.getColumnNumber()); fOut.print(":"); fOut.print(locator.getByteOffset()); fOut.print(","); fOut.print(locator.getUtf16Offset()); Node node = locator.getRelatedNode(); if (node != null) { fOut.print("["); fOut.print(node.getNodeName()); fOut.print("]"); } String systemId = locator.getUri(); if (systemId != null) { int index = systemId.lastIndexOf('/'); if (index != -1) systemId = systemId.substring(index + 1); fOut.print(": "); fOut.print(systemId); } } fOut.print(":"); fOut.print(error.getMessage()); fOut.println(); fOut.flush(); }
Example 12
Source File: DOMErrorHandlerWrapper.java From Bytecoder with Apache License 2.0 | 4 votes |
/** Prints the error message. */ private void printError(DOMError error) { int severity = error.getSeverity(); fOut.print("["); if ( severity == DOMError.SEVERITY_WARNING) { fOut.print("Warning"); } else if ( severity == DOMError.SEVERITY_ERROR) { fOut.print("Error"); } else { fOut.print("FatalError"); eStatus = false ; //REVISIT: Abort processing if fatal error, do we need to?? } fOut.print("] "); DOMLocator locator = error.getLocation(); if (locator != null) { fOut.print(locator.getLineNumber()); fOut.print(":"); fOut.print(locator.getColumnNumber()); fOut.print(":"); fOut.print(locator.getByteOffset()); fOut.print(","); fOut.print(locator.getUtf16Offset()); Node node = locator.getRelatedNode(); if (node != null) { fOut.print("["); fOut.print(node.getNodeName()); fOut.print("]"); } String systemId = locator.getUri(); if (systemId != null) { int index = systemId.lastIndexOf('/'); if (index != -1) systemId = systemId.substring(index + 1); fOut.print(": "); fOut.print(systemId); } } fOut.print(":"); fOut.print(error.getMessage()); fOut.println(); fOut.flush(); }
Example 13
Source File: DOMErrorHandlerWrapper.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** Prints the error message. */ private void printError(DOMError error) { int severity = error.getSeverity(); fOut.print("["); if ( severity == DOMError.SEVERITY_WARNING) { fOut.print("Warning"); } else if ( severity == DOMError.SEVERITY_ERROR) { fOut.print("Error"); } else { fOut.print("FatalError"); eStatus = false ; //REVISIT: Abort processing if fatal error, do we need to?? } fOut.print("] "); DOMLocator locator = error.getLocation(); if (locator != null) { fOut.print(locator.getLineNumber()); fOut.print(":"); fOut.print(locator.getColumnNumber()); fOut.print(":"); fOut.print(locator.getByteOffset()); fOut.print(","); fOut.print(locator.getUtf16Offset()); Node node = locator.getRelatedNode(); if (node != null) { fOut.print("["); fOut.print(node.getNodeName()); fOut.print("]"); } String systemId = locator.getUri(); if (systemId != null) { int index = systemId.lastIndexOf('/'); if (index != -1) systemId = systemId.substring(index + 1); fOut.print(": "); fOut.print(systemId); } } fOut.print(":"); fOut.print(error.getMessage()); fOut.println(); fOut.flush(); }
Example 14
Source File: DOMErrorHandlerWrapper.java From hottub with GNU General Public License v2.0 | 4 votes |
/** Prints the error message. */ private void printError(DOMError error) { int severity = error.getSeverity(); fOut.print("["); if ( severity == DOMError.SEVERITY_WARNING) { fOut.print("Warning"); } else if ( severity == DOMError.SEVERITY_ERROR) { fOut.print("Error"); } else { fOut.print("FatalError"); eStatus = false ; //REVISIT: Abort processing if fatal error, do we need to?? } fOut.print("] "); DOMLocator locator = error.getLocation(); if (locator != null) { fOut.print(locator.getLineNumber()); fOut.print(":"); fOut.print(locator.getColumnNumber()); fOut.print(":"); fOut.print(locator.getByteOffset()); fOut.print(","); fOut.print(locator.getUtf16Offset()); Node node = locator.getRelatedNode(); if (node != null) { fOut.print("["); fOut.print(node.getNodeName()); fOut.print("]"); } String systemId = locator.getUri(); if (systemId != null) { int index = systemId.lastIndexOf('/'); if (index != -1) systemId = systemId.substring(index + 1); fOut.print(": "); fOut.print(systemId); } } fOut.print(":"); fOut.print(error.getMessage()); fOut.println(); fOut.flush(); }
Example 15
Source File: DOMErrorHandlerWrapper.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** Prints the error message. */ private void printError(DOMError error) { int severity = error.getSeverity(); fOut.print("["); if ( severity == DOMError.SEVERITY_WARNING) { fOut.print("Warning"); } else if ( severity == DOMError.SEVERITY_ERROR) { fOut.print("Error"); } else { fOut.print("FatalError"); eStatus = false ; //REVISIT: Abort processing if fatal error, do we need to?? } fOut.print("] "); DOMLocator locator = error.getLocation(); if (locator != null) { fOut.print(locator.getLineNumber()); fOut.print(":"); fOut.print(locator.getColumnNumber()); fOut.print(":"); fOut.print(locator.getByteOffset()); fOut.print(","); fOut.print(locator.getUtf16Offset()); Node node = locator.getRelatedNode(); if (node != null) { fOut.print("["); fOut.print(node.getNodeName()); fOut.print("]"); } String systemId = locator.getUri(); if (systemId != null) { int index = systemId.lastIndexOf('/'); if (index != -1) systemId = systemId.substring(index + 1); fOut.print(": "); fOut.print(systemId); } } fOut.print(":"); fOut.print(error.getMessage()); fOut.println(); fOut.flush(); }
Example 16
Source File: DOMErrorHandlerWrapper.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** Prints the error message. */ private void printError(DOMError error) { int severity = error.getSeverity(); fOut.print("["); if ( severity == DOMError.SEVERITY_WARNING) { fOut.print("Warning"); } else if ( severity == DOMError.SEVERITY_ERROR) { fOut.print("Error"); } else { fOut.print("FatalError"); eStatus = false ; //REVISIT: Abort processing if fatal error, do we need to?? } fOut.print("] "); DOMLocator locator = error.getLocation(); if (locator != null) { fOut.print(locator.getLineNumber()); fOut.print(":"); fOut.print(locator.getColumnNumber()); fOut.print(":"); fOut.print(locator.getByteOffset()); fOut.print(","); fOut.print(locator.getUtf16Offset()); Node node = locator.getRelatedNode(); if (node != null) { fOut.print("["); fOut.print(node.getNodeName()); fOut.print("]"); } String systemId = locator.getUri(); if (systemId != null) { int index = systemId.lastIndexOf('/'); if (index != -1) systemId = systemId.substring(index + 1); fOut.print(": "); fOut.print(systemId); } } fOut.print(":"); fOut.print(error.getMessage()); fOut.println(); fOut.flush(); }