/**
* Returns the node in the given document at the specified XPath.
*
* @param node
* The document to be checked.
* @param xpathString
* The xpath to look at.
* @return The node at the given xpath.
* @throws XPathExpressionException
*/
public static Node getNodeByXPath(Node node, String xpathString)
throws XPathExpressionException {
final XPathFactory factory = XPathFactory.newInstance();
final XPath xpath = factory.newXPath();
xpath.setNamespaceContext(new XmlNamespaceResolver(
getOwningDocument(node)));
final XPathExpression expr = xpath.compile(xpathString);
return (Node) expr.evaluate(node, XPathConstants.NODE);
}
XMLConverter.java 文件源码
java
阅读 37
收藏 0
点赞 0
评论 0
项目:oscm
作者:
评论列表
文章目录