You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

基于JDK17的应用移除Xerces2,寻求XML解析验证替代方案

寻求替代Xerces的XML解析与验证方案

我们的应用基于JDK17构建,原本采用Xerces2实现XML相关功能,但Xerces2开发已停滞,最后一版本发布于2022年,因此计划将其从代码库中移除。

JDK9引入模块机制后,我们不得不使用--add-exports java.xml/com.sun.org.apache.xerces.internal.impl.xs=ALL-UNNAMED参数,来直接调用JDK内部基于Xerces的方法。

现寻求可替代Xerces的XML解析、验证方案,当前代码中使用的相关导入如下:

import static com.sun.org.apache.xerces.internal.xs.XSConstants.ELEMENT_DECLARATION;
import com.sun.org.apache.xerces.internal.xs.XSAttributeUse;
import com.sun.org.apache.xerces.internal.xs.XSComplexTypeDefinition;
import com.sun.org.apache.xerces.internal.xs.XSConstants;
import com.sun.org.apache.xerces.internal.xs.XSElementDeclaration;
import com.sun.org.apache.xerces.internal.xs.XSModelGroup;
import com.sun.org.apache.xerces.internal.xs.XSObjectList;
import com.sun.org.apache.xerces.internal.xs.XSParticle;
import com.sun.org.apache.xerces.internal.xs.XSTerm;
import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition;

我曾考虑使用Jakarta XML,但未找到可替代现有方法的同类实现。

内容的提问来源于stack exchange,提问作者BloodFury

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 08:12:04