org.w3c.dom.DOMError#SEVERITY_ERROR源码实例Demo

下面列出了org.w3c.dom.DOMError#SEVERITY_ERROR 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

/**
 * Reports an error. Errors are non-fatal and usually signify that the
 * document is invalid with respect to its grammar(s).
 *
 * @param domain    The domain of the error. The domain can be any
 *                  string but is suggested to be a valid URI. The
 *                  domain can be used to conveniently specify a web
 *                  site location of the relevent specification or
 *                  document pertaining to this error.
 * @param key       The error key. This key can be any string and
 *                  is implementation dependent.
 * @param exception Exception.
 *
 * @throws XNIException Thrown to signal that the parser should stop
 *                      parsing the document.
 */
public void error(String domain, String key,
                  XMLParseException exception) throws XNIException {
    fDOMError.fSeverity = DOMError.SEVERITY_ERROR;
    fDOMError.fException = exception;
    // REVISIT: May need to lookup from DOMErrorTypeMap in the future.
    fDOMError.fType = key;
    fDOMError.fRelatedData = fDOMError.fMessage = exception.getMessage();
    DOMLocatorImpl locator = fDOMError.fLocator;
    if (locator != null) {
        locator.fColumnNumber = exception.getColumnNumber();
        locator.fLineNumber = exception.getLineNumber();
        locator.fUtf16Offset = exception.getCharacterOffset();
        locator.fUri = exception.getExpandedSystemId();
        locator.fRelatedNode= fCurrentNode;
    }
    if (fDomErrorHandler != null) {
        fDomErrorHandler.handleError(fDOMError);
    }
}
 
源代码2 项目: openjdk-8   文件: DOMErrorHandlerWrapper.java
/**
 * Reports an error. Errors are non-fatal and usually signify that the
 * document is invalid with respect to its grammar(s).
 *
 * @param domain    The domain of the error. The domain can be any
 *                  string but is suggested to be a valid URI. The
 *                  domain can be used to conveniently specify a web
 *                  site location of the relevent specification or
 *                  document pertaining to this error.
 * @param key       The error key. This key can be any string and
 *                  is implementation dependent.
 * @param exception Exception.
 *
 * @throws XNIException Thrown to signal that the parser should stop
 *                      parsing the document.
 */
public void error(String domain, String key,
                  XMLParseException exception) throws XNIException {
    fDOMError.fSeverity = DOMError.SEVERITY_ERROR;
    fDOMError.fException = exception;
    // REVISIT: May need to lookup from DOMErrorTypeMap in the future.
    fDOMError.fType = key;
    fDOMError.fRelatedData = fDOMError.fMessage = exception.getMessage();
    DOMLocatorImpl locator = fDOMError.fLocator;
    if (locator != null) {
        locator.fColumnNumber = exception.getColumnNumber();
        locator.fLineNumber = exception.getLineNumber();
        locator.fUtf16Offset = exception.getCharacterOffset();
        locator.fUri = exception.getExpandedSystemId();
        locator.fRelatedNode= fCurrentNode;
    }
    if (fDomErrorHandler != null) {
        fDomErrorHandler.handleError(fDOMError);
    }
}
 
源代码3 项目: JDKSourceCode1.8   文件: DOMErrorHandlerWrapper.java
/**
 * Reports an error. Errors are non-fatal and usually signify that the
 * document is invalid with respect to its grammar(s).
 *
 * @param domain    The domain of the error. The domain can be any
 *                  string but is suggested to be a valid URI. The
 *                  domain can be used to conveniently specify a web
 *                  site location of the relevent specification or
 *                  document pertaining to this error.
 * @param key       The error key. This key can be any string and
 *                  is implementation dependent.
 * @param exception Exception.
 *
 * @throws XNIException Thrown to signal that the parser should stop
 *                      parsing the document.
 */
public void error(String domain, String key,
                  XMLParseException exception) throws XNIException {
    fDOMError.fSeverity = DOMError.SEVERITY_ERROR;
    fDOMError.fException = exception;
    // REVISIT: May need to lookup from DOMErrorTypeMap in the future.
    fDOMError.fType = key;
    fDOMError.fRelatedData = fDOMError.fMessage = exception.getMessage();
    DOMLocatorImpl locator = fDOMError.fLocator;
    if (locator != null) {
        locator.fColumnNumber = exception.getColumnNumber();
        locator.fLineNumber = exception.getLineNumber();
        locator.fUtf16Offset = exception.getCharacterOffset();
        locator.fUri = exception.getExpandedSystemId();
        locator.fRelatedNode= fCurrentNode;
    }
    if (fDomErrorHandler != null) {
        fDomErrorHandler.handleError(fDOMError);
    }
}
 
源代码4 项目: openjdk-jdk8u   文件: DOMErrorHandlerWrapper.java
/**
 * Reports an error. Errors are non-fatal and usually signify that the
 * document is invalid with respect to its grammar(s).
 *
 * @param domain    The domain of the error. The domain can be any
 *                  string but is suggested to be a valid URI. The
 *                  domain can be used to conveniently specify a web
 *                  site location of the relevent specification or
 *                  document pertaining to this error.
 * @param key       The error key. This key can be any string and
 *                  is implementation dependent.
 * @param exception Exception.
 *
 * @throws XNIException Thrown to signal that the parser should stop
 *                      parsing the document.
 */
public void error(String domain, String key,
                  XMLParseException exception) throws XNIException {
    fDOMError.fSeverity = DOMError.SEVERITY_ERROR;
    fDOMError.fException = exception;
    // REVISIT: May need to lookup from DOMErrorTypeMap in the future.
    fDOMError.fType = key;
    fDOMError.fRelatedData = fDOMError.fMessage = exception.getMessage();
    DOMLocatorImpl locator = fDOMError.fLocator;
    if (locator != null) {
        locator.fColumnNumber = exception.getColumnNumber();
        locator.fLineNumber = exception.getLineNumber();
        locator.fUtf16Offset = exception.getCharacterOffset();
        locator.fUri = exception.getExpandedSystemId();
        locator.fRelatedNode= fCurrentNode;
    }
    if (fDomErrorHandler != null) {
        fDomErrorHandler.handleError(fDOMError);
    }
}
 
/**
 * Reports an error. Errors are non-fatal and usually signify that the
 * document is invalid with respect to its grammar(s).
 *
 * @param domain    The domain of the error. The domain can be any
 *                  string but is suggested to be a valid URI. The
 *                  domain can be used to conveniently specify a web
 *                  site location of the relevent specification or
 *                  document pertaining to this error.
 * @param key       The error key. This key can be any string and
 *                  is implementation dependent.
 * @param exception Exception.
 *
 * @throws XNIException Thrown to signal that the parser should stop
 *                      parsing the document.
 */
public void error(String domain, String key,
                  XMLParseException exception) throws XNIException {
    fDOMError.fSeverity = DOMError.SEVERITY_ERROR;
    fDOMError.fException = exception;
    // REVISIT: May need to lookup from DOMErrorTypeMap in the future.
    fDOMError.fType = key;
    fDOMError.fRelatedData = fDOMError.fMessage = exception.getMessage();
    DOMLocatorImpl locator = fDOMError.fLocator;
    if (locator != null) {
        locator.fColumnNumber = exception.getColumnNumber();
        locator.fLineNumber = exception.getLineNumber();
        locator.fUtf16Offset = exception.getCharacterOffset();
        locator.fUri = exception.getExpandedSystemId();
        locator.fRelatedNode= fCurrentNode;
    }
    if (fDomErrorHandler != null) {
        fDomErrorHandler.handleError(fDOMError);
    }
}
 
源代码6 项目: j2objc   文件: DOMErrorHandlerImpl.java
/**
 * 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;
}
 
源代码7 项目: openjdk-jdk9   文件: DOMErrorHandlerWrapper.java
/**
 * Reports an error. Errors are non-fatal and usually signify that the
 * document is invalid with respect to its grammar(s).
 *
 * @param domain    The domain of the error. The domain can be any
 *                  string but is suggested to be a valid URI. The
 *                  domain can be used to conveniently specify a web
 *                  site location of the relevent specification or
 *                  document pertaining to this error.
 * @param key       The error key. This key can be any string and
 *                  is implementation dependent.
 * @param exception Exception.
 *
 * @throws XNIException Thrown to signal that the parser should stop
 *                      parsing the document.
 */
public void error(String domain, String key,
                  XMLParseException exception) throws XNIException {
    fDOMError.fSeverity = DOMError.SEVERITY_ERROR;
    fDOMError.fException = exception;
    // REVISIT: May need to lookup from DOMErrorTypeMap in the future.
    fDOMError.fType = key;
    fDOMError.fRelatedData = fDOMError.fMessage = exception.getMessage();
    DOMLocatorImpl locator = fDOMError.fLocator;
    if (locator != null) {
        locator.fColumnNumber = exception.getColumnNumber();
        locator.fLineNumber = exception.getLineNumber();
        locator.fUtf16Offset = exception.getCharacterOffset();
        locator.fUri = exception.getExpandedSystemId();
        locator.fRelatedNode= fCurrentNode;
    }
    if (fDomErrorHandler != null) {
        fDomErrorHandler.handleError(fDOMError);
    }
}
 
源代码8 项目: openjdk-8-source   文件: DOMErrorHandlerWrapper.java
/**
 * Reports an error. Errors are non-fatal and usually signify that the
 * document is invalid with respect to its grammar(s).
 *
 * @param domain    The domain of the error. The domain can be any
 *                  string but is suggested to be a valid URI. The
 *                  domain can be used to conveniently specify a web
 *                  site location of the relevent specification or
 *                  document pertaining to this error.
 * @param key       The error key. This key can be any string and
 *                  is implementation dependent.
 * @param exception Exception.
 *
 * @throws XNIException Thrown to signal that the parser should stop
 *                      parsing the document.
 */
public void error(String domain, String key,
                  XMLParseException exception) throws XNIException {
    fDOMError.fSeverity = DOMError.SEVERITY_ERROR;
    fDOMError.fException = exception;
    // REVISIT: May need to lookup from DOMErrorTypeMap in the future.
    fDOMError.fType = key;
    fDOMError.fRelatedData = fDOMError.fMessage = exception.getMessage();
    DOMLocatorImpl locator = fDOMError.fLocator;
    if (locator != null) {
        locator.fColumnNumber = exception.getColumnNumber();
        locator.fLineNumber = exception.getLineNumber();
        locator.fUtf16Offset = exception.getCharacterOffset();
        locator.fUri = exception.getExpandedSystemId();
        locator.fRelatedNode= fCurrentNode;
    }
    if (fDomErrorHandler != null) {
        fDomErrorHandler.handleError(fDOMError);
    }
}
 
源代码9 项目: openjdk-jdk9   文件: DOMErrorHandlerImpl.java
/**
 * 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;
}
 
源代码10 项目: hottub   文件: DOMErrorHandlerWrapper.java
/**
 * Reports an error. Errors are non-fatal and usually signify that the
 * document is invalid with respect to its grammar(s).
 *
 * @param domain    The domain of the error. The domain can be any
 *                  string but is suggested to be a valid URI. The
 *                  domain can be used to conveniently specify a web
 *                  site location of the relevent specification or
 *                  document pertaining to this error.
 * @param key       The error key. This key can be any string and
 *                  is implementation dependent.
 * @param exception Exception.
 *
 * @throws XNIException Thrown to signal that the parser should stop
 *                      parsing the document.
 */
public void error(String domain, String key,
                  XMLParseException exception) throws XNIException {
    fDOMError.fSeverity = DOMError.SEVERITY_ERROR;
    fDOMError.fException = exception;
    // REVISIT: May need to lookup from DOMErrorTypeMap in the future.
    fDOMError.fType = key;
    fDOMError.fRelatedData = fDOMError.fMessage = exception.getMessage();
    DOMLocatorImpl locator = fDOMError.fLocator;
    if (locator != null) {
        locator.fColumnNumber = exception.getColumnNumber();
        locator.fLineNumber = exception.getLineNumber();
        locator.fUtf16Offset = exception.getCharacterOffset();
        locator.fUri = exception.getExpandedSystemId();
        locator.fRelatedNode= fCurrentNode;
    }
    if (fDomErrorHandler != null) {
        fDomErrorHandler.handleError(fDOMError);
    }
}
 
/** 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();

    }
 
源代码12 项目: openjdk-8-source   文件: DOMErrorHandlerWrapper.java
/** 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();

    }
 
源代码13 项目: TencentKona-8   文件: DOMErrorHandlerWrapper.java
/** 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();

    }
 
源代码14 项目: jdk8u60   文件: DOMErrorHandlerWrapper.java
/** 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();

    }
 
源代码15 项目: JDKSourceCode1.8   文件: DOMErrorHandlerWrapper.java
/** 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();

    }
 
源代码16 项目: openjdk-jdk8u   文件: DOMErrorHandlerWrapper.java
/** 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();

    }
 
/** 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();

    }
 
源代码18 项目: Bytecoder   文件: DOMErrorHandlerWrapper.java
/** 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();

    }
 
源代码19 项目: openjdk-8   文件: DOMErrorHandlerWrapper.java
/** 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();

    }
 
源代码20 项目: hottub   文件: DOMErrorHandlerWrapper.java
/** 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();

    }