当前位置: 首页>>代码示例>>Java>>正文


Java XPathContext.getSAXLocator方法代码示例

本文整理汇总了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);
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:27,代码来源:FuncDocument.java

示例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);
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:26,代码来源:FuncDocument.java


注:本文中的org.apache.xpath.XPathContext.getSAXLocator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。