SAXParseExceptionpublic class SAXParseException extends SAXException Encapsulate an XML parse error or warning.
This module, both source code and documentation, is in the
Public Domain, and comes with NO WARRANTY.
See http://www.saxproject.org
for further information.
This exception may include information for locating the error
in the original XML document, as if it came from a {@link Locator}
object. Note that although the application
will receive a SAXParseException as the argument to the handlers
in the {@link org.xml.sax.ErrorHandler 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 {@link org.xml.sax.SAXException
SAXException}, it inherits the ability to wrap another exception. |
Fields Summary |
---|
private String | publicId | private String | systemId | private int | lineNumber | private int | columnNumber | static final long | serialVersionUID |
Constructors 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 {@link org.xml.sax.ContentHandler
ContentHandler} callback.
super(message);
if (locator != null) {
init(locator.getPublicId(), locator.getSystemId(),
locator.getLineNumber(), locator.getColumnNumber());
} else {
init(null, null, -1, -1);
}
| 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 {@link org.xml.sax.ContentHandler
ContentHandler} callback, and needs to wrap an existing exception that is not a
subclass of {@link org.xml.sax.SAXException SAXException}.
super(message, e);
if (locator != null) {
init(locator.getPublicId(), locator.getSystemId(),
locator.getLineNumber(), locator.getColumnNumber());
} else {
init(null, null, -1, -1);
}
| 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 {@link Locator}. For example, if the
system identifier is a URL (including relative filename), the
caller must resolve it fully before creating the exception.
super(message);
init(publicId, systemId, lineNumber, columnNumber);
| 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
{@link org.xml.sax.SAXException SAXException}.
All parameters except the message and exception are as if
they were provided by a {@link Locator}. For example, if the
system identifier is a URL (including relative filename), the
caller must resolve it fully before creating the exception.
super(message, e);
init(publicId, systemId, lineNumber, columnNumber);
|
Methods 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.
return this.columnNumber;
| public int | getLineNumber()The line number of the end of the text where the exception occurred.
The first line is line 1.
return this.lineNumber;
| public java.lang.String | getPublicId()Get the public identifier of the entity where the exception occurred.
return this.publicId;
| public java.lang.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.
return this.systemId;
| private void | init(java.lang.String publicId, java.lang.String systemId, int lineNumber, int columnNumber)Internal initialization method.
this.publicId = publicId;
this.systemId = systemId;
this.lineNumber = lineNumber;
this.columnNumber = columnNumber;
|
|