001/*
002 * Copyright (c) 2004 World Wide Web Consortium,
003 *
004 * (Massachusetts Institute of Technology, European Research Consortium for
005 * Informatics and Mathematics, Keio University). All Rights Reserved. This
006 * work is distributed under the W3C(r) Software License [1] in the hope that
007 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
008 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
009 *
010 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
011 */
012
013package org.w3c.dom;
014
015/**
016 * <code>DOMError</code> is an interface that describes an error.
017 * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
018 * @since DOM Level 3
019 */
020public interface DOMError {
021    // ErrorSeverity
022    /**
023     * The severity of the error described by the <code>DOMError</code> is 
024     * warning. A <code>SEVERITY_WARNING</code> will not cause the 
025     * processing to stop, unless <code>DOMErrorHandler.handleError()</code> 
026     * returns <code>false</code>.
027     */
028    public static final short SEVERITY_WARNING          = 1;
029    /**
030     * The severity of the error described by the <code>DOMError</code> is 
031     * error. A <code>SEVERITY_ERROR</code> may not cause the processing to 
032     * stop if the error can be recovered, unless 
033     * <code>DOMErrorHandler.handleError()</code> returns <code>false</code>.
034     */
035    public static final short SEVERITY_ERROR            = 2;
036    /**
037     * The severity of the error described by the <code>DOMError</code> is 
038     * fatal error. A <code>SEVERITY_FATAL_ERROR</code> will cause the 
039     * normal processing to stop. The return value of 
040     * <code>DOMErrorHandler.handleError()</code> is ignored unless the 
041     * implementation chooses to continue, in which case the behavior 
042     * becomes undefined.
043     */
044    public static final short SEVERITY_FATAL_ERROR      = 3;
045
046    /**
047     * The severity of the error, either <code>SEVERITY_WARNING</code>, 
048     * <code>SEVERITY_ERROR</code>, or <code>SEVERITY_FATAL_ERROR</code>.
049     */
050    public short getSeverity();
051
052    /**
053     * An implementation specific string describing the error that occurred.
054     */
055    public String getMessage();
056
057    /**
058     *  A <code>DOMString</code> indicating which related data is expected in 
059     * <code>relatedData</code>. Users should refer to the specification of 
060     * the error in order to find its <code>DOMString</code> type and 
061     * <code>relatedData</code> definitions if any. 
062     * <p ><b>Note:</b>  As an example, 
063     * <code>Document.normalizeDocument()</code> does generate warnings when 
064     * the "split-cdata-sections" parameter is in use. Therefore, the method 
065     * generates a <code>SEVERITY_WARNING</code> with <code>type</code> 
066     * <code>"cdata-sections-splitted"</code> and the first 
067     * <code>CDATASection</code> node in document order resulting from the 
068     * split is returned by the <code>relatedData</code> attribute. 
069     */
070    public String getType();
071
072    /**
073     * The related platform dependent exception if any.
074     */
075    public Object getRelatedException();
076
077    /**
078     *  The related <code>DOMError.type</code> dependent data if any. 
079     */
080    public Object getRelatedData();
081
082    /**
083     * The location of the error.
084     */
085    public DOMLocator getLocation();
086
087}