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

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

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

Node.asXPathResult介绍

[英]asXPathResult returns a version of this node which is capable of being an XPath result. The result of an XPath expression should always support the parent relationship, whether the original XML tree was singly or doubly linked. If the node does not support the parent relationship then a new node will be created which is linked to its parent and returned.
[中]asXPathResult返回此节点的一个版本,该版本可以作为XPath结果。XPath表达式的结果应始终支持父关系,无论原始XML树是单链接还是双链接。如果节点不支持父关系,则将创建一个链接到其父节点并返回的新节点。

代码示例

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

  1. public Node getXPathResult(int index) {
  2. Node answer = node(index);
  3. if ((answer != null) && !answer.supportsParent()) {
  4. return answer.asXPathResult(this);
  5. }
  6. return answer;
  7. }

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

  1. public Node getXPathResult(int index) {
  2. Node answer = node(index);
  3. if ((answer != null) && !answer.supportsParent()) {
  4. return answer.asXPathResult(this);
  5. }
  6. return answer;
  7. }

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

  1. public Node getXPathResult(int index) {
  2. Node answer = node(index);
  3. if ((answer != null) && !answer.supportsParent()) {
  4. return answer.asXPathResult(this);
  5. }
  6. return answer;
  7. }

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

  1. public Node getXPathResult(int index) {
  2. Node answer = node(index);
  3. if ((answer != null) && !answer.supportsParent()) {
  4. return answer.asXPathResult(this);
  5. }
  6. return answer;
  7. }

代码示例来源:origin: org.dom4j/com.springsource.org.dom4j

  1. public Node getXPathResult(int index) {
  2. Node answer = node(index);
  3. if ((answer != null) && !answer.supportsParent()) {
  4. return answer.asXPathResult(this);
  5. }
  6. return answer;
  7. }

代码示例来源:origin: org.dom4j/org.motechproject.org.dom4j

  1. public Node getXPathResult(int index) {
  2. Node answer = node(index);
  3. if ((answer != null) && !answer.supportsParent()) {
  4. return answer.asXPathResult(this);
  5. }
  6. return answer;
  7. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j

  1. public Node getXPathResult(int index) {
  2. Node answer = node(index);
  3. if ((answer != null) && !answer.supportsParent()) {
  4. return answer.asXPathResult(this);
  5. }
  6. return answer;
  7. }

代码示例来源:origin: org.jenkins-ci.dom4j/dom4j

  1. public Node getXPathResult(int index) {
  2. Node answer = node(index);
  3. if ((answer != null) && !answer.supportsParent()) {
  4. return answer.asXPathResult(this);
  5. }
  6. return answer;
  7. }

代码示例来源:origin: apache/servicemix-bundles

  1. public Node getXPathResult(int index) {
  2. Node answer = node(index);
  3. if ((answer != null) && !answer.supportsParent()) {
  4. return answer.asXPathResult(this);
  5. }
  6. return answer;
  7. }

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

  1. protected void testXPathNode(Element parent, Node node) {
  2. if (node.supportsParent()) {
  3. log("Node: " + node);
  4. log("Parent: " + parent);
  5. log("getParent(): " + node.getParent());
  6. assertTrue("getParent() returns parent for: " + node, node
  7. .getParent() == parent);
  8. } else {
  9. // lets create an XPath node
  10. Node xpathNode = node.asXPathResult(parent);
  11. assertTrue("XPath Node supports parent for: " + xpathNode,
  12. xpathNode.supportsParent());
  13. assertTrue("getParent() returns parent for: " + xpathNode,
  14. xpathNode.getParent() == parent);
  15. }
  16. }
  17. }

相关文章