|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Throwable | +--java.lang.Exception | +--java.io.IOException | +--org.openxml.parser.ParseException
SAXParseException
Parent class for all parsing exceptions. Three derived classes exist based on severity of error:
ERROR_FATAL
severity,
ERROR_WELL_FORMED
severity, and
ERROR_VALIDITY
severity
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).
Parser
,
SourceLocation
,
FatalParseException
,
ValidityException
,
WellFormedException
,
Parser.getLastException()
, Serialized FormField 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 |
public static final short ERROR_FATAL
public static final short ERROR_WELL_FORMED
public static final short ERROR_VALIDITY
public static final short STOP_SEVERITY_FATAL
FatalParseException
.public static final short STOP_SEVERITY_WELL_FORMED
WellFormedException
. This level also implies STOP_SEVERITY_FATAL
.public static final short STOP_SEVERITY_VALIDITY
ValidityException
.
This level also implies STOP_SEVERITY_WELL_FORMED
.Method Detail |
public java.lang.Exception getPrevious()
public final int getLineNumber()
public final int getSourcePosition()
public final java.lang.String getSourceURI()
public abstract int getLevel()
ERROR_FATAL
, ERROR_WELL_FORMED
or ERROR_VALIDITY
.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |