本文整理匯總了Java中javax.xml.transform.ErrorListener.fatalError方法的典型用法代碼示例。如果您正苦於以下問題:Java ErrorListener.fatalError方法的具體用法?Java ErrorListener.fatalError怎麽用?Java ErrorListener.fatalError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.xml.transform.ErrorListener
的用法示例。
在下文中一共展示了ErrorListener.fatalError方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: newXMLFilter
import javax.xml.transform.ErrorListener; //導入方法依賴的package包/類
public XMLFilter newXMLFilter(Templates templates)
throws TransformerConfigurationException {
try {
return new com.sun.org.apache.xalan.internal.xsltc.trax.TrAXFilter(templates);
}
catch(TransformerConfigurationException e1) {
if (_xsltcFactory == null) {
createXSLTCTransformerFactory();
}
ErrorListener errorListener = _xsltcFactory.getErrorListener();
if(errorListener != null) {
try {
errorListener.fatalError(e1);
return null;
}
catch( TransformerException e2) {
new TransformerConfigurationException(e2);
}
}
throw e1;
}
}
示例2: error
import javax.xml.transform.ErrorListener; //導入方法依賴的package包/類
/**
* Tell the user of an error, and probably throw an
* exception.
*
* @param xctxt The XPath runtime context.
* @param sourceNode Not used.
* @param msg An error msgkey that corresponds to one of the constants found
* in {@link com.sun.org.apache.xpath.internal.res.XPATHErrorResources}, which is
* a key for a format string.
* @param args An array of arguments represented in the format string, which
* may be null.
*
* @throws TransformerException if the current ErrorListoner determines to
* throw an exception.
*/
public void error(
XPathContext xctxt, int sourceNode, String msg, Object[] args)
throws javax.xml.transform.TransformerException
{
String fmsg = XSLMessages.createXPATHMessage(msg, args);
ErrorListener ehandler = xctxt.getErrorListener();
if (null != ehandler)
{
ehandler.fatalError(new TransformerException(fmsg,
(SAXSourceLocator)xctxt.getSAXLocator()));
}
else
{
SourceLocator slocator = xctxt.getSAXLocator();
System.out.println(fmsg + "; file " + slocator.getSystemId()
+ "; line " + slocator.getLineNumber() + "; column "
+ slocator.getColumnNumber());
}
}
示例3: error
import javax.xml.transform.ErrorListener; //導入方法依賴的package包/類
/**
* Notify the user of an error, and probably throw an
* exception.
*
* @param msg An error msgkey that corresponds to one of the constants found
* in {@link com.sun.org.apache.xpath.internal.res.XPATHErrorResources}, which is
* a key for a format string.
* @param args An array of arguments represented in the format string, which
* may be null.
*
* @throws TransformerException if the current ErrorListoner determines to
* throw an exception.
*/
void error(String msg, Object[] args) throws TransformerException
{
String fmsg = XSLMessages.createXPATHMessage(msg, args);
ErrorListener ehandler = this.getErrorListener();
TransformerException te = new TransformerException(fmsg, m_sourceLocator);
if (null != ehandler)
{
// TO DO: Need to get stylesheet Locator from here.
ehandler.fatalError(te);
}
else
{
// System.err.println(fmsg);
throw te;
}
}
示例4: errorForDOM3
import javax.xml.transform.ErrorListener; //導入方法依賴的package包/類
/**
* This method is added to support DOM 3 XPath API.
* <p>
* This method is exactly like error(String, Object[]); except that
* the underlying TransformerException is
* XpathStylesheetDOM3Exception (which extends TransformerException).
* <p>
* So older XPath code in Xalan is not affected by this. To older XPath code
* the behavior of whether error() or errorForDOM3() is called because it is
* always catching TransformerException objects and is oblivious to
* the new subclass of XPathStylesheetDOM3Exception. Older XPath code
* runs as before.
* <p>
* However, newer DOM3 XPath code upon catching a TransformerException can
* can check if the exception is an instance of XPathStylesheetDOM3Exception
* and take appropriate action.
*
* @param msg An error msgkey that corresponds to one of the constants found
* in {@link com.sun.org.apache.xpath.internal.res.XPATHErrorResources}, which is
* a key for a format string.
* @param args An array of arguments represented in the format string, which
* may be null.
*
* @throws TransformerException if the current ErrorListoner determines to
* throw an exception.
*/
void errorForDOM3(String msg, Object[] args) throws TransformerException
{
String fmsg = XSLMessages.createXPATHMessage(msg, args);
ErrorListener ehandler = this.getErrorListener();
TransformerException te = new XPathStylesheetDOM3Exception(fmsg, m_sourceLocator);
if (null != ehandler)
{
// TO DO: Need to get stylesheet Locator from here.
ehandler.fatalError(te);
}
else
{
// System.err.println(fmsg);
throw te;
}
}
示例5: error
import javax.xml.transform.ErrorListener; //導入方法依賴的package包/類
/**
* Tell the user of an error, and probably throw an
* exception.
*
* @param xctxt The XPath runtime context.
* @param msg An error msgkey that corresponds to one of the constants found
* in {@link com.sun.org.apache.xpath.internal.res.XPATHErrorResources}, which is
* a key for a format string.
* @param args An array of arguments represented in the format string, which
* may be null.
*
* @throws TransformerException if the current ErrorListoner determines to
* throw an exception.
*
* @throws javax.xml.transform.TransformerException
*/
public void error(XPathContext xctxt, String msg, Object[] args)
throws javax.xml.transform.TransformerException
{
java.lang.String fmsg = XSLMessages.createXPATHMessage(msg, args);
if (null != xctxt)
{
ErrorListener eh = xctxt.getErrorListener();
TransformerException te = new TransformerException(fmsg, this);
eh.fatalError(te);
}
}