本文整理汇总了Java中org.apache.xpath.XPathContext.getErrorListener方法的典型用法代码示例。如果您正苦于以下问题:Java XPathContext.getErrorListener方法的具体用法?Java XPathContext.getErrorListener怎么用?Java XPathContext.getErrorListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xpath.XPathContext
的用法示例。
在下文中一共展示了XPathContext.getErrorListener方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例3: 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 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();
errHandler.warning(new TransformerException(formattedMsg,
(SAXSourceLocator)xctxt.getSAXLocator()));
}
示例4: AVTPartXPath
import org.apache.xpath.XPathContext; //导入方法依赖的package包/类
/**
* Construct a simple AVT part.
*
* @param val A pure string section of an AVT.
* @param nsNode An object which can be used to determine the
* Namespace Name (URI) for any Namespace prefix used in the XPath.
* Usually this is based on the context where the XPath was specified,
* such as a node within a Stylesheet.
* @param xpathProcessor XPath parser
* @param factory XPath factory
* @param liaison An XPathContext object, providing infomation specific
* to this invocation and this thread. Maintains SAX output state,
* variables, error handler and so on, so the transformation/XPath
* object itself can be simultaneously invoked from multiple threads.
*
* @throws javax.xml.transform.TransformerException
* TODO: Fix or remove this unused c'tor.
*/
public AVTPartXPath(
String val, org.apache.xml.utils.PrefixResolver nsNode,
XPathParser xpathProcessor, XPathFactory factory,
XPathContext liaison)
throws javax.xml.transform.TransformerException
{
m_xpath = new XPath(val, null, nsNode, XPath.SELECT, liaison.getErrorListener());
}