play.libs.XPath.bindUnboundedNamespaces()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(10.3k)|赞(0)|评价(0)|浏览(93)

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

XPath.bindUnboundedNamespaces介绍

暂无

代码示例

代码示例来源:origin: com.typesafe.play/play-java_2.10

public static Node selectNode(String path, Object node, Map<String, String> namespaces) {
  try {
    XPathFactory factory = XPathFactory.newInstance();
    javax.xml.xpath.XPath xpath = factory.newXPath();
    
    if (namespaces != null) {
      SimpleNamespaceContext nsContext = new SimpleNamespaceContext();
      bindUnboundedNamespaces(nsContext, namespaces);
      xpath.setNamespaceContext(nsContext);
    }
    return (Node) xpath.evaluate(path, node, XPathConstants.NODE);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.typesafe.play/play-java

public static Node selectNode(String path, Object node, Map<String, String> namespaces) {
  try {
    XPathFactory factory = XPathFactory.newInstance();
    javax.xml.xpath.XPath xpath = factory.newXPath();
    
    if (namespaces != null) {
      PlayNamespaceContext nsContext = new PlayNamespaceContext();
      bindUnboundedNamespaces(nsContext, namespaces);
      xpath.setNamespaceContext(nsContext);
    }
    return (Node) xpath.evaluate(path, node, XPathConstants.NODE);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.typesafe.play/play-java_2.11

public static Node selectNode(String path, Object node, Map<String, String> namespaces) {
  try {
    XPathFactory factory = XPathFactory.newInstance();
    javax.xml.xpath.XPath xpath = factory.newXPath();
    
    if (namespaces != null) {
      PlayNamespaceContext nsContext = new PlayNamespaceContext();
      bindUnboundedNamespaces(nsContext, namespaces);
      xpath.setNamespaceContext(nsContext);
    }
    return (Node) xpath.evaluate(path, node, XPathConstants.NODE);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.typesafe.play/play-java_2.12

public static Node selectNode(String path, Object node, Map<String, String> namespaces) {
  try {
    XPathFactory factory = XPathFactory.newInstance();
    javax.xml.xpath.XPath xpath = factory.newXPath();
    
    if (namespaces != null) {
      PlayNamespaceContext nsContext = new PlayNamespaceContext();
      bindUnboundedNamespaces(nsContext, namespaces);
      xpath.setNamespaceContext(nsContext);
    }
    return (Node) xpath.evaluate(path, node, XPathConstants.NODE);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: play/play-java

public static Node selectNode(String path, Object node, Map<String, String> namespaces) {
  try {
    XPathFactory factory = XPathFactory.newInstance();
    javax.xml.xpath.XPath xpath = factory.newXPath();
    
    if (namespaces != null) {
      SimpleNamespaceContext nsContext = new SimpleNamespaceContext();
      bindUnboundedNamespaces(nsContext, namespaces);
      xpath.setNamespaceContext(nsContext);
    }
    return (Node) xpath.evaluate(path, node, XPathConstants.NODE);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.typesafe.play/play-java_2.10

/**
 * Return the text of a node, or the value of an attribute
 * @param path the XPath to execute
 * @param node the node, node-set or Context object for evaluation. This value can be null.
 */
public static String selectText(String path, Object node, Map<String, String> namespaces) {
  try {
    XPathFactory factory = XPathFactory.newInstance();
    javax.xml.xpath.XPath xpath = factory.newXPath();
    if (namespaces != null) {
      SimpleNamespaceContext nsContext = new SimpleNamespaceContext();
      bindUnboundedNamespaces(nsContext, namespaces);
      xpath.setNamespaceContext(nsContext);
    }
    return (String) xpath.evaluate(path, node, XPathConstants.STRING);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.typesafe.play/play-java_2.12

/**
 * @param path the XPath to execute
 * @param node the node, node-set or Context object for evaluation. This value can be null.
 * @param namespaces    the XML namespaces map
 * @return the text of a node, or the value of an attribute
 */
public static String selectText(String path, Object node, Map<String, String> namespaces) {
  try {
    XPathFactory factory = XPathFactory.newInstance();
    javax.xml.xpath.XPath xpath = factory.newXPath();
    if (namespaces != null) {
      PlayNamespaceContext nsContext = new PlayNamespaceContext();
      bindUnboundedNamespaces(nsContext, namespaces);
      xpath.setNamespaceContext(nsContext);
    }
    return (String) xpath.evaluate(path, node, XPathConstants.STRING);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: play/play-java

/**
 * Select all nodes that are selected by this XPath expression. If multiple nodes match,
 * multiple nodes will be returned. Nodes will be returned in document-order,
 * @param path
 * @param node
 * @param namespaces Namespaces that need to be available in the xpath, where the key is the
 * prefix and the value the namespace URI
 * @return
 */
public static NodeList selectNodes(String path, Object node, Map<String, String> namespaces) {
  try {
    XPathFactory factory = XPathFactory.newInstance();
    javax.xml.xpath.XPath xpath = factory.newXPath();
    
    if (namespaces != null) {
      SimpleNamespaceContext nsContext = new SimpleNamespaceContext();
      bindUnboundedNamespaces(nsContext, namespaces);
      xpath.setNamespaceContext(nsContext);
    }
    return (NodeList) xpath.evaluate(path, node, XPathConstants.NODESET);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: play/play-java

/**
 * Return the text of a node, or the value of an attribute
 * @param path the XPath to execute
 * @param node the node, node-set or Context object for evaluation. This value can be null.
 */
public static String selectText(String path, Object node, Map<String, String> namespaces) {
  try {
    XPathFactory factory = XPathFactory.newInstance();
    javax.xml.xpath.XPath xpath = factory.newXPath();
    if (namespaces != null) {
      SimpleNamespaceContext nsContext = new SimpleNamespaceContext();
      bindUnboundedNamespaces(nsContext, namespaces);
      xpath.setNamespaceContext(nsContext);
    }
    return (String) xpath.evaluate(path, node, XPathConstants.STRING);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.typesafe.play/play-java_2.11

/**
 * @param path the XPath to execute
 * @param node the node, node-set or Context object for evaluation. This value can be null.
 * @param namespaces    the XML namespaces map
 * @return the text of a node, or the value of an attribute
 */
public static String selectText(String path, Object node, Map<String, String> namespaces) {
  try {
    XPathFactory factory = XPathFactory.newInstance();
    javax.xml.xpath.XPath xpath = factory.newXPath();
    if (namespaces != null) {
      PlayNamespaceContext nsContext = new PlayNamespaceContext();
      bindUnboundedNamespaces(nsContext, namespaces);
      xpath.setNamespaceContext(nsContext);
    }
    return (String) xpath.evaluate(path, node, XPathConstants.STRING);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.typesafe.play/play-java

/**
 * @param path the XPath to execute
 * @param node the node, node-set or Context object for evaluation. This value can be null.
 * @param namespaces    the XML namespaces map
 * @return the text of a node, or the value of an attribute
 */
public static String selectText(String path, Object node, Map<String, String> namespaces) {
  try {
    XPathFactory factory = XPathFactory.newInstance();
    javax.xml.xpath.XPath xpath = factory.newXPath();
    if (namespaces != null) {
      PlayNamespaceContext nsContext = new PlayNamespaceContext();
      bindUnboundedNamespaces(nsContext, namespaces);
      xpath.setNamespaceContext(nsContext);
    }
    return (String) xpath.evaluate(path, node, XPathConstants.STRING);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.typesafe.play/play-java_2.11

/**
 * Select all nodes that are selected by this XPath expression. If multiple nodes match,
 * multiple nodes will be returned. Nodes will be returned in document-order,
 * @param path the xpath expression
 * @param node the starting node
 * @param namespaces Namespaces that need to be available in the xpath, where the key is the
 * prefix and the value the namespace URI
 * @return result of evaluating the xpath expression against node
 */
public static NodeList selectNodes(String path, Object node, Map<String, String> namespaces) {
  try {
    XPathFactory factory = XPathFactory.newInstance();
    javax.xml.xpath.XPath xpath = factory.newXPath();
    
    if (namespaces != null) {
      PlayNamespaceContext nsContext = new PlayNamespaceContext();
      bindUnboundedNamespaces(nsContext, namespaces);
      xpath.setNamespaceContext(nsContext);
    }
    return (NodeList) xpath.evaluate(path, node, XPathConstants.NODESET);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.typesafe.play/play-java_2.10

/**
 * Select all nodes that are selected by this XPath expression. If multiple nodes match,
 * multiple nodes will be returned. Nodes will be returned in document-order,
 * @param path
 * @param node
 * @param namespaces Namespaces that need to be available in the xpath, where the key is the
 * prefix and the value the namespace URI
 * @return
 */
public static NodeList selectNodes(String path, Object node, Map<String, String> namespaces) {
  try {
    XPathFactory factory = XPathFactory.newInstance();
    javax.xml.xpath.XPath xpath = factory.newXPath();
    
    if (namespaces != null) {
      SimpleNamespaceContext nsContext = new SimpleNamespaceContext();
      bindUnboundedNamespaces(nsContext, namespaces);
      xpath.setNamespaceContext(nsContext);
    }
    return (NodeList) xpath.evaluate(path, node, XPathConstants.NODESET);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.typesafe.play/play-java

/**
 * Select all nodes that are selected by this XPath expression. If multiple nodes match,
 * multiple nodes will be returned. Nodes will be returned in document-order,
 * @param path the xpath expression
 * @param node the starting node
 * @param namespaces Namespaces that need to be available in the xpath, where the key is the
 * prefix and the value the namespace URI
 * @return result of evaluating the xpath expression against node
 */
public static NodeList selectNodes(String path, Object node, Map<String, String> namespaces) {
  try {
    XPathFactory factory = XPathFactory.newInstance();
    javax.xml.xpath.XPath xpath = factory.newXPath();
    
    if (namespaces != null) {
      PlayNamespaceContext nsContext = new PlayNamespaceContext();
      bindUnboundedNamespaces(nsContext, namespaces);
      xpath.setNamespaceContext(nsContext);
    }
    return (NodeList) xpath.evaluate(path, node, XPathConstants.NODESET);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.typesafe.play/play-java_2.12

/**
 * Select all nodes that are selected by this XPath expression. If multiple nodes match,
 * multiple nodes will be returned. Nodes will be returned in document-order,
 * @param path the xpath expression
 * @param node the starting node
 * @param namespaces Namespaces that need to be available in the xpath, where the key is the
 * prefix and the value the namespace URI
 * @return result of evaluating the xpath expression against node
 */
public static NodeList selectNodes(String path, Object node, Map<String, String> namespaces) {
  try {
    XPathFactory factory = XPathFactory.newInstance();
    javax.xml.xpath.XPath xpath = factory.newXPath();
    
    if (namespaces != null) {
      PlayNamespaceContext nsContext = new PlayNamespaceContext();
      bindUnboundedNamespaces(nsContext, namespaces);
      xpath.setNamespaceContext(nsContext);
    }
    return (NodeList) xpath.evaluate(path, node, XPathConstants.NODESET);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

相关文章

微信公众号

最新文章

更多