/**
* @param xmlString
* @return
* @throws Exception
*/
public static String findFunction(String xmlString) throws Exception {
DocumentBuilder document = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Element node = document.parse(new ByteArrayInputStream(xmlString.getBytes())).getDocumentElement();
//Xpath
XPath xpath = XPathFactory.newInstance().newXPath();
XPathExpression expr = xpath.compile("//*[local-name()='Envelope']/*[local-name()='Body']/*");
Object result = expr.evaluate(node, XPathConstants.NODESET);
NodeList nodes = (NodeList) result;
if (log.isDebugEnabled()) {
log.debug("nodes.item(0).getNodeName():" + nodes.item(0).getNodeName());
}
if (nodes.item(0).getNodeName().contains("query")) {
return "query";
} else if (nodes.item(0).getNodeName().contains("update")) {
return "update";
} else {
return null;
}
}
TransformationHelper.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:jaffa-framework
作者:
评论列表
文章目录