org.dom4j.Node.createXPath()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(209)

本文整理了Java中org.dom4j.Node.createXPath()方法的一些代码示例,展示了Node.createXPath()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.createXPath()方法的具体详情如下:
包路径:org.dom4j.Node
类名称:Node
方法名:createXPath

Node.createXPath介绍

[英]createXPath creates an XPath object for the given xpathExpression. The XPath object allows the variable context to be specified.
[中]

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

  1. XPath xpathField = node.createXPath( addNSPrefix( XPathValue, data.PathValue ) );
  2. xpathField.setNamespaceURIs( data.NAMESPACE );
  3. if ( xmlDataField.getResultType() == GetXMLDataField.RESULT_TYPE_VALUE_OF ) {

代码示例来源:origin: dom4j/dom4j

  1. protected void testXPath(Node node, String xpathText) {
  2. XPath xpath = node.createXPath(xpathText);
  3. Object object = xpath.evaluate(node);
  4. }
  5. }

代码示例来源:origin: dom4j/dom4j

  1. protected void testXPath(Node node, String xpathExpr) throws Exception {
  2. try {
  3. XPath xpath = node.createXPath(xpathExpr);
  4. String value = xpath.valueOf(node);
  5. log("valueOf: " + xpathExpr + " is: " + value);
  6. } catch (Throwable e) {
  7. e.printStackTrace();
  8. assertTrue("Failed with exception: " + e, false);
  9. }
  10. }
  11. }

代码示例来源:origin: dom4j/dom4j

  1. protected void testXPath(Node node, String xpathText) throws Exception {
  2. try {
  3. XPath xpath = node.createXPath(xpathText);
  4. Number number = xpath.numberValueOf(node);
  5. log("Searched path: " + xpathText + " found: " + number);
  6. } catch (Throwable e) {
  7. log("Caught exception: " + e);
  8. e.printStackTrace();
  9. assertTrue("Failed to process: " + xpathText
  10. + " caught exception: " + e, false);
  11. }
  12. }
  13. }

相关文章