Browse Source

setNamespaceAware as true

Looly 5 years ago
parent
commit
308368cffd
2 changed files with 3 additions and 0 deletions
  1. 1 0
      CHANGELOG.md
  2. 2 0
      hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java

+ 1 - 0
CHANGELOG.md

@@ -11,6 +11,7 @@
 * 【core   】     PageUtil支持setFirstPageNo自定义第一页的页码(issue#I1CGNZ@Gitee)
 * 【http   】     UserAgentUtil增加Chromium内核的Edge浏览器支持(issue#800@Github)
 * 【cache  】     修改FIFOCache中linkedHashMap的初始容量策略(pr#801@Github)
+* 【core   】     修改XmlUtil中setNamespaceAware默认为true
 
 ### Bug修复
 * 【core   】     修复NumberWordFormatter拼写错误(issue#799@Github)

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

@@ -474,6 +474,8 @@ public class XmlUtil {
 		} else {
 			factory = DocumentBuilderFactory.newInstance();
 		}
+		// 默认打开NamespaceAware,getElementsByTagNameNS可以使用命名空间
+		factory.setNamespaceAware(true);
 		return disableXXE(factory);
 	}