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 eb0e34ea8..93739c56b 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 @@ -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)) {