Methods Summary |
---|
public static void | ensureLocationSet(javax.xml.transform.TransformerException exception)
// SourceLocator locator = exception.getLocator();
SourceLocator locator = null;
Throwable cause = exception;
// Try to find the locator closest to the cause.
do
{
if(cause instanceof SAXParseException)
{
locator = new SAXSourceLocator((SAXParseException)cause);
}
else if (cause instanceof TransformerException)
{
SourceLocator causeLocator = ((TransformerException)cause).getLocator();
if(null != causeLocator)
locator = causeLocator;
}
if(cause instanceof TransformerException)
cause = ((TransformerException)cause).getCause();
else if(cause instanceof SAXException)
cause = ((SAXException)cause).getException();
else
cause = null;
}
while(null != cause);
exception.setLocator(locator);
|
public void | error(org.xml.sax.SAXParseException exception)Receive notification of a recoverable error.
This corresponds to the definition of "error" in section 1.2
of the W3C XML 1.0 Recommendation. For example, a validating
parser would use this callback to report the violation of a
validity constraint. The default behaviour is to take no
action.
The SAX parser must continue to provide normal parsing events
after invoking this method: it should still be possible for the
application to process the document through to the end. If the
application cannot do so, then the parser should report a fatal
error even if the XML 1.0 recommendation does not require it to
do so.
//printLocation(exception);
// m_pw.println(exception.getMessage());
throw exception;
|
public void | error(javax.xml.transform.TransformerException exception)Receive notification of a recoverable error.
This corresponds to the definition of "error" in section 1.2
of the W3C XML 1.0 Recommendation. For example, a validating
parser would use this callback to report the violation of a
validity constraint. The default behaviour is to take no
action.
The SAX parser must continue to provide normal parsing events
after invoking this method: it should still be possible for the
application to process the document through to the end. If the
application cannot do so, then the parser should report a fatal
error even if the XML 1.0 recommendation does not require it to
do so.
// printLocation(exception);
// ensureLocationSet(exception);
printLocation(m_pw, exception);
m_pw.println(exception.getMessage());
//throw exception;
|
public void | fatalError(org.xml.sax.SAXParseException exception)Receive notification of a non-recoverable error.
This corresponds to the definition of "fatal error" in
section 1.2 of the W3C XML 1.0 Recommendation. For example, a
parser would use this callback to report the violation of a
well-formedness constraint.
The application must assume that the document is unusable
after the parser has invoked this method, and should continue
(if at all) only for the sake of collecting addition error
messages: in fact, SAX parsers are free to stop reporting any
other events once this method has been invoked.
// printLocation(exception);
// m_pw.println(exception.getMessage());
throw exception;
|
public void | fatalError(javax.xml.transform.TransformerException exception)Receive notification of a non-recoverable error.
This corresponds to the definition of "fatal error" in
section 1.2 of the W3C XML 1.0 Recommendation. For example, a
parser would use this callback to report the violation of a
well-formedness constraint.
The application must assume that the document is unusable
after the parser has invoked this method, and should continue
(if at all) only for the sake of collecting addition error
messages: in fact, SAX parsers are free to stop reporting any
other events once this method has been invoked.
// printLocation(exception);
// ensureLocationSet(exception);
throw exception;
|
public static void | printLocation(java.io.PrintStream pw, javax.xml.transform.TransformerException exception)
printLocation(new PrintWriter(pw), exception);
|
public static void | printLocation(java.io.PrintStream pw, org.xml.sax.SAXParseException exception)
printLocation(new PrintWriter(pw), exception);
|
public static void | printLocation(java.io.PrintWriter pw, java.lang.Throwable exception)
SourceLocator locator = null;
Throwable cause = exception;
// Try to find the locator closest to the cause.
do
{
if(cause instanceof SAXParseException)
{
locator = new SAXSourceLocator((SAXParseException)cause);
}
else if (cause instanceof TransformerException)
{
SourceLocator causeLocator = ((TransformerException)cause).getLocator();
if(null != causeLocator)
locator = causeLocator;
}
if(cause instanceof TransformerException)
cause = ((TransformerException)cause).getCause();
else if(cause instanceof WrappedRuntimeException)
cause = ((WrappedRuntimeException)cause).getException();
else if(cause instanceof SAXException)
cause = ((SAXException)cause).getException();
else
cause = null;
}
while(null != cause);
if(null != locator)
{
// m_pw.println("Parser fatal error: "+exception.getMessage());
String id = (null != locator.getPublicId() )
? locator.getPublicId()
: (null != locator.getSystemId())
? locator.getSystemId() : XMLMessages.createXMLMessage(XMLErrorResources.ER_SYSTEMID_UNKNOWN, null); //"SystemId Unknown";
pw.print(id + "; " +XMLMessages.createXMLMessage("line", null) + locator.getLineNumber()
+ "; " +XMLMessages.createXMLMessage("column", null) + locator.getColumnNumber()+"; ");
}
else
pw.print("("+XMLMessages.createXMLMessage(XMLErrorResources.ER_LOCATION_UNKNOWN, null)+")");
|
public void | warning(org.xml.sax.SAXParseException exception)Receive notification of a warning.
SAX parsers will use this method to report conditions that
are not errors or fatal errors as defined by the XML 1.0
recommendation. The default behaviour is to take no action.
The SAX parser must continue to provide normal parsing events
after invoking this method: it should still be possible for the
application to process the document through to the end.
printLocation(m_pw, exception);
m_pw.println("Parser warning: " + exception.getMessage());
|
public void | warning(javax.xml.transform.TransformerException exception)Receive notification of a warning.
SAX parsers will use this method to report conditions that
are not errors or fatal errors as defined by the XML 1.0
recommendation. The default behaviour is to take no action.
The SAX parser must continue to provide normal parsing events
after invoking this method: it should still be possible for the
application to process the document through to the end.
printLocation(m_pw, exception);
m_pw.println(exception.getMessage());
|