From cf10fc9acc5787b4069c87caa94c53d708ba6c37 Mon Sep 17 00:00:00 2001 From: Looly Date: Wed, 22 Jan 2020 07:32:48 +0800 Subject: [PATCH] add omit xml declaration --- CHANGELOG.md | 1 + hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a1e6b70f..ec6a18d4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ## 5.1.2 ### 新特性 +* 【core 】 XmlUtil支持可选是否输出omit xml declaration(pr#732@Gtihub) ### Bug修复 * 【core 】 修复isExpired的bug(issue#733@Gtihub) diff --git a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java b/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java index c4bf446ad..fdac8e5eb 100644 --- a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java +++ b/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 map = xmlToMap(childEle);