处理带名称空间XML的XPATH

Document document = DocumentHelper
.parseText(getResponseBodyAsString());
String xpathExpression = "//" + XML_WBXC_MULTISTATUS + "/"
+ XML_WBXC_TASKSTATUS + "/" + XML_WBXC_TASK + "/" + tag;
XPath xpath = DocumentHelper.createXPath(xpathExpression);
HashMap<String, String> hashMap = new HashMap<String, String>();
hashMap.put(XML_WBXC_NAMESPACE, XML_WBXC_NAMESPACE_URL);
xpath.setNamespaceURIs(hashMap);
Node node = xpath.selectSingleNode(document);
if (node != null)
return node.getText();

你可能感兴趣的:(xpath)