Bläddra i källkod

1.恩泽xml工具修改

hujing 4 år sedan
förälder
incheckning
15ab5712b6

+ 18 - 5
trans/src/main/java/com/lantone/qc/trans/beilun/util/ez/util/EzXmlUtil.java

@@ -51,18 +51,31 @@ public class EzXmlUtil {
      */
     public static void putNode(Element node, Map<String, String> map) {
         String labelName = node.getName();
-        String text = node.getStringValue();
         List<Attribute> listAttr = node.attributes();// 所有属性
         for (Attribute attr : listAttr) {// 遍历所有属性
-            String name = attr.getName();// 属性名称
-            String value = attr.getValue();// 属性的值
-            if (("fieldelem".equals(labelName) || "section".equals(labelName)) && StringUtil.isNotBlank(value)) {
+            //String name = attr.getName();// 属性名称
+            if (("fieldelem".equals(labelName)) && StringUtil.isNotBlank(attr.getValue())) {
                 /*
                 if (text.contains(":") && text.indexOf(":") < text.length()) {
                     text = text.substring(text.indexOf(":") + 1);
                 }
                  */
-                map.put(value, text);
+                String fieldelemKey = attr.getValue();// 属性的值
+                String text = node.getStringValue();
+                map.put(fieldelemKey, text);
+            }
+            if ("section".equals(labelName)) {
+                List<Element> content = node.content();
+                if (content.size() > 0) {
+                    Element firstEle = content.get(0);
+                    String key = firstEle.getStringValue();
+                    String value = "";
+                    for (int i = 1; i < content.size(); i++) {
+                        String v = content.get(i).getStringValue();
+                        value += v + " ";
+                    }
+                    map.put(key, value);
+                }
             }
         }
     }