Browse Source

Merge pull request #1234 from CherryRum/v5-dev

修改使用xml.setXmlStandalone(true)设定属性后,父节点格式化位置不对。
Golden Looly 5 years ago
parent
commit
281341ebd7
1 changed files with 1 additions and 0 deletions
  1. 1 0
      hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java

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

@@ -587,6 +587,7 @@ public class XmlUtil {
 			final Transformer xformer = factory.newTransformer();
 			if (indent > 0) {
 				xformer.setOutputProperty(OutputKeys.INDENT, "yes");
+				xformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, "yes");
 				xformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", String.valueOf(indent));
 			}
 			if (StrUtil.isNotBlank(charset)) {