Java in a Nutshell, 5th Edition [Electronic resources]

نسخه متنی -صفحه : 1191/ 1141
نمايش فراداده

SAXParseExceptionorg.xml.sax

Java 1.4serializable checked

An exception of this type signals an XML parsing error or warning. SAXParseException includes methods to return the system and public identifiers of the document in which the error or warning occurred, as well as methods to return the approximate line number and column number at which it occurred. A parser is not required to obtain or track all of this information, and the methods may return null or -1 if the information is not available. (See Locator for more information.)

Exceptions of this type are usually thrown by the application from the methods of the ErrorHandler interface. The parser never throws a SAXParseException itself, but does pass an appropriately initialized instance of this class to each of the ErrorHandler methods. It is up to the application's ErrorHandler object to decide whether to actually throw the exception, however.

Figure 22-5. org.xml.sax.SAXParseException

public class

SAXParseException extends SAXException { // Public Constructors public

SAXParseException (String

message , Locator

locator ); public

SAXParseException (String

message , Locator

locator , Exception

e ); public

SAXParseException (String

message , String

publicId , String

systemId , int

lineNumber , int

columnNumber ); public

SAXParseException (String

message , String

publicId , String

systemId , int

lineNumber , int

columnNumber , Exception

e ); // Public Instance Methods public int

getColumnNumber ( ); public int

getLineNumber ( ); public String

getPublicId ( ); public String

getSystemId ( ); }

Passed To

ErrorHandler.{error( ), fatalError( ), warning( )}, HandlerBase.{error( ), fatalError( ), warning( )}, org.xml.sax.helpers.DefaultHandler.{error( ), fatalError( ), warning( )}, org.xml.sax.helpers.XMLFilterImpl.{error( ), fatalError( ), warning( )}