|
@@ -49,4 +49,22 @@ public class CxXmlUtil {
|
|
|
return retMap;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取xml某一路径节点的内容
|
|
|
+ *
|
|
|
+ * @param xml
|
|
|
+ * @param nodePath 节点在xml中的路径位置
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static String getTextByNodePath(String xml, String nodePath) {
|
|
|
+ String content = null;
|
|
|
+ try {
|
|
|
+ Document doc = DocumentHelper.parseText(xml);
|
|
|
+ Element element = (Element) doc.selectNodes(nodePath).get(0);
|
|
|
+ content = element.getTextTrim();
|
|
|
+ } catch (Exception e) {
|
|
|
+ }
|
|
|
+ return content;
|
|
|
+ }
|
|
|
+
|
|
|
}
|