java - ElementNSImpl 类型的对象以 com.sun.org.apache.xerces.internal.dom.ElementNSImpl 的形式出现
问题描述
所以我部署在 JDK1.8.0_161 环境中的 WS-Trust 服务器期待一个包含 xml 类型节点的org.apache.xerces.dom.ElementNSImpl
请求,但是当请求到来时,节点是 type com.sun.org.apache.xerces.internal.dom.ElementNSImpl
,这不会让我不从请求中读取数据。我正在使用xerces:xercesImpl:2.11.0
库,但想知道 JDK 是否弄乱了服务器端的请求解析。目前我只看到rt.jar
包含com.sun.org.apache.xerces.internal.dom.ElementNSImpl
. 我错过了什么?有没有人看到这个错误?
解决方案
我通过使用Element
as interface 而不是使用 implementation解决了这个问题ElementNSImpl
。这将使实现环境独立。
所以代码看起来像这样
if(object instanceof org.w3c.dom.Element)
代替
if(object instanceof ElementNSImpl)
推荐阅读
- javascript - Testcafe - 页面对象结构和默认类
- xamarin - 签名板 Xamarin.Forms 将签名另存为文件
- javascript - 如何使用 require.js 加载 Vue.js 和我的自定义 Vue 库
- xcode - 如何快速修复 Xcode 的打开问题?
- azure - Azure 托管数据磁盘未加密
- java - Set 的映射需要 Id?
- sql - 按 SQL Server 中每个结果集的记录数分组
- r - 通过“for”循环调用列
- java - 通过 bolt 暴露嵌入式 Neo4J OGM 数据库
- interrupt - 在 STM32F4XX 上写入非易失性存储器而不中断 UART 中断执行