ソースを参照

add omit xml declaration

Looly 5 年 前
コミット
cf10fc9acc

+ 1 - 0
CHANGELOG.md

@@ -6,6 +6,7 @@
 ## 5.1.2
 
 ### 新特性
+* 【core 】     XmlUtil支持可选是否输出omit xml declaration(pr#732@Gtihub)
 
 ### Bug修复
 * 【core 】     修复isExpired的bug(issue#733@Gtihub)

+ 1 - 1
hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java

@@ -809,7 +809,7 @@ public class XmlUtil {
 
 			childEle = (Element) childNode;
 			final Object value = result.get(childEle.getNodeName());
-			Object newValue = null;
+			Object newValue;
 			if (childEle.hasChildNodes()) {
 				// 子节点继续递归遍历
 				final Map<String, Object> map = xmlToMap(childEle);