本文整理汇总了Java中org.apache.xpath.XPathContext.getSAXLocator方法的典型用法代码示例。如果您正苦于以下问题:Java XPathContext.getSAXLocator方法的具体用法?Java XPathContext.getSAXLocator怎么用?Java XPathContext.getSAXLocator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xpath.XPathContext
的用法示例。
在下文中一共展示了XPathContext.getSAXLocator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: error
import org.apache.xpath.XPathContext; //导入方法依赖的package包/类
/**
* Tell the user of an error, and probably throw an
* exception.
*
* @param xctxt The XPath runtime state.
* @param msg The error message key
* @param args Arguments to be used in the error message
* @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
* the error condition is severe enough to halt processing.
*
* @throws javax.xml.transform.TransformerException
*/
public void error(XPathContext xctxt, String msg, Object args[])
throws javax.xml.transform.TransformerException
{
String formattedMsg = XSLMessages.createMessage(msg, args);
ErrorListener errHandler = xctxt.getErrorListener();
TransformerException spe = new TransformerException(formattedMsg,
(SourceLocator)xctxt.getSAXLocator());
if (null != errHandler)
errHandler.error(spe);
else
System.out.println(formattedMsg);
}
示例2: warn
import org.apache.xpath.XPathContext; //导入方法依赖的package包/类
/**
* Warn the user of a problem.
*
* @param xctxt The XPath runtime state.
* @param msg Warning message key
* @param args Arguments to be used in the warning message
* @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
* the error condition is severe enough to halt processing.
*
* @throws javax.xml.transform.TransformerException
*/
public void warn(XPathContext xctxt, String msg, Object args[])
throws javax.xml.transform.TransformerException
{
String formattedMsg = XSLMessages.createWarning(msg, args);
ErrorListener errHandler = xctxt.getErrorListener();
TransformerException spe = new TransformerException(formattedMsg,
(SourceLocator)xctxt.getSAXLocator());
if (null != errHandler)
errHandler.warning(spe);
else
System.out.println(formattedMsg);
}