如何在 Oracle DB 中禁用 XML DTD 验证?
我在查询的选择部分中使用以下语句:
extract(XMLTYPE(doc.payload),'/SHOW_SHIPMENT_005/DATAAREA/SHOW_SHIPMENT/SHIPMENT/SHIPITEM/DOCUMNTREF/DOCUMENTID')
如果 doc.payload
包含 XML
而没有 DTD
声明,则效果很好,但会引发当存在 DTD
声明时出现错误,因为 Oracle 尝试验证文档但找不到 DTD
。
如何禁用此查询的 XML
验证? 我不想在这件事上影响我的会话设置或全局系统设置。
I am using following statement in select portion of the query:
extract(XMLTYPE(doc.payload),'/SHOW_SHIPMENT_005/DATAAREA/SHOW_SHIPMENT/SHIPMENT/SHIPITEM/DOCUMNTREF/DOCUMENTID')
it works well if the doc.payload
contains XML
without DTD
declaration, but raises an error when DTD
declaration is present as Oracle tries to validate the document but cannot find the DTD
.
How to disable the XML
validation for this query? I don't want to affect my session setting nor global system setting in this matter.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在创建 XMLTYPE 时关闭验证,构造函数签名如下所示:
因此您可以像这样禁用验证:
但是,如果您有外部 DTD 引用,这对您没有帮助。 它仍然会尝试加载它。 是否无法将 DTD 文件上传到 XMLDB 存储库? 这将是最简单的解决方案。 如果没有,就没有“好的”解决方案,您必须在创建 XMLTYPE 之前删除 DTD 引用:
You can turn off validation when you create an XMLTYPE, constructor signature looks like this:
So you can disable validation like this:
This will not help you though, if you have an external DTD reference. It'd still try to load it. Is it not possible to upload the DTD file into the XMLDB repository? That would be the simplest solution. If not, there is no 'nice' solution, you have to get rid of the DTD reference before creating the XMLTYPE: