Top Description Fields Constructors Methods
org.xml.sax

public Class SAXParseException

extends SAXException
Class Inheritance

Encapsulate an XML parse error or warning.

This exception may include information for locating the error in the original XML document, as if it came from a Locator object. Note that although the application will receive a SAXParseException as the argument to the handlers in the ErrorHandler interface, the application is not actually required to throw the exception; instead, it can simply read the information in it and take a different action.

Since this exception is a subclass of SAXException, it inherits the ability to wrap another exception.

Author
David Megginson
Since
1.4, SAX 1.0
Version
2.0.1 (sax2r2)
See Also
org.xml.sax.SAXException, org.xml.sax.Locator, org.xml.sax.ErrorHandler

Field Summary

Modifier and TypeField and Description
private int
private int
private String
pack-priv static final long
private String

Constructor Summary

AccessConstructor and Description
public
SAXParseException(String
The error or warning message.
message
,
Locator
The locator object for the error or warning (may be null).
locator
)

Create a new SAXParseException from a message and a Locator.

public
SAXParseException(String
The error or warning message, or null to use the message from the embedded exception.
message
,
Locator
The locator object for the error or warning (may be null).
locator
,
Exception
Any exception.
e
)

Wrap an existing exception in a SAXParseException.

public
SAXParseException(String
The error or warning message.
message
,
String
The public identifier of the entity that generated the error or warning.
publicId
,
String
The system identifier of the entity that generated the error or warning.
systemId
,
int
The line number of the end of the text that caused the error or warning.
lineNumber
,
int
The column number of the end of the text that cause the error or warning.
columnNumber
)

Create a new SAXParseException.

public
SAXParseException(String
The error or warning message, or null to use the message from the embedded exception.
message
,
String
The public identifier of the entity that generated the error or warning.
publicId
,
String
The system identifier of the entity that generated the error or warning.
systemId
,
int
The line number of the end of the text that caused the error or warning.
lineNumber
,
int
The column number of the end of the text that cause the error or warning.
columnNumber
,
Exception
Another exception to embed in this one.
e
)

Create a new SAXParseException with an embedded exception.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

An integer representing the column number, or -1 if none is available.
getColumnNumber
()

The column number of the end of the text where the exception occurred.

public int

Returns:

An integer representing the line number, or -1 if none is available.
getLineNumber
()

The line number of the end of the text where the exception occurred.

public String

Returns:

A string containing the public identifier, or null if none is available.
getPublicId
()

Get the public identifier of the entity where the exception occurred.

public String

Returns:

A string containing the system identifier, or null if none is available.
getSystemId
()

Get the system identifier of the entity where the exception occurred.

private void
init(String
The public identifier of the entity which generated the exception, or null.
publicId
,
String
The system identifier of the entity which generated the exception, or null.
systemId
,
int
The line number of the error, or -1.
lineNumber
,
int
The column number of the error, or -1.
columnNumber
)

Internal initialization method.

public String

Returns:

A string representation of this exception.
toString
()

Overrides org.xml.sax.SAXException.toString.

Override toString to provide more detailed error message.
Inherited from org.xml.sax.SAXException:
getCausegetExceptiongetMessage

Field Detail

columnNumberback to summary
private int columnNumber
See Also
getColumnNumber
lineNumberback to summary
private int lineNumber
See Also
getLineNumber
publicIdback to summary
private String publicId
See Also
getPublicId
serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides org.xml.sax.SAXException.serialVersionUID.

systemIdback to summary
private String systemId
See Also
getSystemId

Constructor Detail

SAXParseExceptionback to summary
public SAXParseException(String message, Locator locator)

Create a new SAXParseException from a message and a Locator.

This constructor is especially useful when an application is creating its own exception from within a ContentHandler callback.

Parameters
message:String

The error or warning message.

locator:Locator

The locator object for the error or warning (may be null).

See Also
org.xml.sax.Locator
SAXParseExceptionback to summary
public SAXParseException(String message, Locator locator, Exception e)

Wrap an existing exception in a SAXParseException.

This constructor is especially useful when an application is creating its own exception from within a ContentHandler callback, and needs to wrap an existing exception that is not a subclass of SAXException.

Parameters
message:String

The error or warning message, or null to use the message from the embedded exception.

locator:Locator

The locator object for the error or warning (may be null).

e:Exception

Any exception.

See Also
org.xml.sax.Locator
SAXParseExceptionback to summary
public SAXParseException(String message, String publicId, String systemId, int lineNumber, int columnNumber)

Create a new SAXParseException.

This constructor is most useful for parser writers.

All parameters except the message are as if they were provided by a Locator. For example, if the system identifier is a URL (including relative filename), the caller must resolve it fully before creating the exception.

Parameters
message:String

The error or warning message.

publicId:String

The public identifier of the entity that generated the error or warning.

systemId:String

The system identifier of the entity that generated the error or warning.

lineNumber:int

The line number of the end of the text that caused the error or warning.

columnNumber:int

The column number of the end of the text that cause the error or warning.

SAXParseExceptionback to summary
public SAXParseException(String message, String publicId, String systemId, int lineNumber, int columnNumber, Exception e)

Create a new SAXParseException with an embedded exception.

This constructor is most useful for parser writers who need to wrap an exception that is not a subclass of SAXException.

All parameters except the message and exception are as if they were provided by a Locator. For example, if the system identifier is a URL (including relative filename), the caller must resolve it fully before creating the exception.

Parameters
message:String

The error or warning message, or null to use the message from the embedded exception.

publicId:String

The public identifier of the entity that generated the error or warning.

systemId:String

The system identifier of the entity that generated the error or warning.

lineNumber:int

The line number of the end of the text that caused the error or warning.

columnNumber:int

The column number of the end of the text that cause the error or warning.

e:Exception

Another exception to embed in this one.

Method Detail

getColumnNumberback to summary
public int getColumnNumber()

The column number of the end of the text where the exception occurred.

The first column in a line is position 1.

Returns:int

An integer representing the column number, or -1 if none is available.

See Also
org.xml.sax.Locator#getColumnNumber
getLineNumberback to summary
public int getLineNumber()

The line number of the end of the text where the exception occurred.

The first line is line 1.

Returns:int

An integer representing the line number, or -1 if none is available.

See Also
org.xml.sax.Locator#getLineNumber
getPublicIdback to summary
public String getPublicId()

Get the public identifier of the entity where the exception occurred.

Returns:String

A string containing the public identifier, or null if none is available.

See Also
org.xml.sax.Locator#getPublicId
getSystemIdback to summary
public String getSystemId()

Get the system identifier of the entity where the exception occurred.

If the system identifier is a URL, it will have been resolved fully.

Returns:String

A string containing the system identifier, or null if none is available.

See Also
org.xml.sax.Locator#getSystemId
initback to summary
private void init(String publicId, String systemId, int lineNumber, int columnNumber)

Internal initialization method.

Parameters
publicId:String

The public identifier of the entity which generated the exception, or null.

systemId:String

The system identifier of the entity which generated the exception, or null.

lineNumber:int

The line number of the error, or -1.

columnNumber:int

The column number of the error, or -1.

toStringback to summary
public String toString()

Overrides org.xml.sax.SAXException.toString.

Override toString to provide more detailed error message.

Returns:String

A string representation of this exception.