org.openxml.parser
Class ParseException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--java.io.IOException
                    |
                    +--org.openxml.parser.ParseException
Direct Known Subclasses:
FatalParseException, ValidityException, WellFormedException

Deprecated. Replaced with SAXParseException

public abstract class ParseException
extends java.io.IOException
implements SourceLocation

Parent class for all parsing exceptions. Three derived classes exist based on severity of error:

When an exception is issued by the parser, it is not always thrown immediately. Often, an exception is preserved and made available when the parser concludes, depending on the severity flag supplied in the parser constructor.

Exceptions of fatal severity are always thrown. Stored exceptions can be obtained by calling Parser.getLastException() and recursively calling getPrevious() on each returned exception.

Well formed exceptions are generated when the document is found to be corrupted, for example, a comment that is not terminated, or a closing tag that has no matching opening tag. Such errors are generated by both validating and non-validating parsers. The parser might attempt to correct/bypass well formed errors and store the exceptions for later retrieval. A well formed exception is always thrown if the parser's stopAtSeverity level is STOP_SEVERITY_WELL_FORMED or STOP_SEVERITY_VALIDITY.

Validity exceptions are generated when the document structure is found not to comply with the document definition as found in the document DTD. Such errors are only generated by a validating parser. The parser might attempt to correct/bypass validity errors and store the exceptions for later retrieval. A validity exception is always thrown if the parser's stopAtSeverity level is STOP_SEVERITY_VALIDITY.

The location of the error can be identified by calling one of the methods defined in the SourceLocation interface. This information is generally, but not always, accurate. It indicates the end (not start) of the token or content element at fault.

Parser exceptions extend IOException so they may be returned when documents are read as part of a larger I/O operation (not explicitly parsed).

Version:
$Revision: 1.5 $ $Date: 1999/04/18 01:52:13 $
Author:
Assaf Arkin
See Also:
Parser, SourceLocation, FatalParseException, ValidityException, WellFormedException, Parser.getLastException(), Serialized Form

Field Summary
static short ERROR_FATAL
          Deprecated. Severity level for fatal errors.
static short ERROR_VALIDITY
          Deprecated. Severity level for validity constraint errors.
static short ERROR_WELL_FORMED
          Deprecated. Severity level for well-formed errors.
static short STOP_SEVERITY_FATAL
          Deprecated. Passed to constructor to indicate the parser should only stop when a fatal parsing error has been issued, throwing an FatalParseException.
static short STOP_SEVERITY_VALIDITY
          Deprecated. Passed to constructor to indicate the parser should stop when the first validity parsing error has been issued, throwing a ValidityException.
static short STOP_SEVERITY_WELL_FORMED
          Deprecated. Passed to constructor to indicate the parser should stop when the first well formed parsing error has been issued, throwing a WellFormedException.
 
Method Summary
abstract  int getLevel()
          Deprecated. Returns the severity level of this exception.
 int getLineNumber()
          Deprecated.  
 java.lang.Exception getPrevious()
          Deprecated.  
 int getSourcePosition()
          Deprecated.  
 java.lang.String getSourceURI()
          Deprecated.  
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getMessage, printStackTrace, printStackTrace, printStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ERROR_FATAL

public static final short ERROR_FATAL
Deprecated. 
Severity level for fatal errors. Once a fatal error has been encountered (e.g. I/O exception), parsing is immediately terminated. Fatal errors are generally I/O exceptions and runtime exceptions.

ERROR_WELL_FORMED

public static final short ERROR_WELL_FORMED
Deprecated. 
Severity level for well-formed errors. Well formed errors may be corrected by the parser, but indicate a document that is faulty and cannot be properly processed. Well-formed errors are issued both by validating and non-validating parsers.

ERROR_VALIDITY

public static final short ERROR_VALIDITY
Deprecated. 
Severity level for validity constraint errors. Validity constraint errors may be corrected by the parser, but indicate a document that does not conform to the DTD. Validity constraint errors are only issued by a validating parser and are very common in HTML documents.

STOP_SEVERITY_FATAL

public static final short STOP_SEVERITY_FATAL
Deprecated. 
Passed to constructor to indicate the parser should only stop when a fatal parsing error has been issued, throwing an FatalParseException.

STOP_SEVERITY_WELL_FORMED

public static final short STOP_SEVERITY_WELL_FORMED
Deprecated. 
Passed to constructor to indicate the parser should stop when the first well formed parsing error has been issued, throwing a WellFormedException. This level also implies STOP_SEVERITY_FATAL.

STOP_SEVERITY_VALIDITY

public static final short STOP_SEVERITY_VALIDITY
Deprecated. 
Passed to constructor to indicate the parser should stop when the first validity parsing error has been issued, throwing a ValidityException. This level also implies STOP_SEVERITY_WELL_FORMED.
Method Detail

getPrevious

public java.lang.Exception getPrevious()
Deprecated. 

getLineNumber

public final int getLineNumber()
Deprecated. 
Specified by:
getLineNumber in interface SourceLocation

getSourcePosition

public final int getSourcePosition()
Deprecated. 
Specified by:
getSourcePosition in interface SourceLocation

getSourceURI

public final java.lang.String getSourceURI()
Deprecated. 
Specified by:
getSourceURI in interface SourceLocation

getLevel

public abstract int getLevel()
Deprecated. 
Returns the severity level of this exception. The severity level is one of ERROR_FATAL, ERROR_WELL_FORMED or ERROR_VALIDITY.
Returns:
The severity level