本文整理汇总了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);
}
}