如何使用 Delphi 读取 DOCTYPE SYSTEM 标识符?

发布于 2024-09-25 01:12:28 字数 433 浏览 0 评论 0原文

对于像 Delphi 2009 这样具有 DOCTPYE 声明的文档

<!DOCTYPE RootElement SYSTEM "file.dtd">

,使用 MSXML 会报告 systemId 为空 (""):

Assert(Doc.DOMDocument.doctype.systemId <> ''); // fails!

同时

Assert(Doc.DOMDocument.doctype.name = 'RootElement'); // ok

正确验证 DOCTYPE 名称 id“RootElement”。

这是 Delphi(或我的代码)中的错误还是我使用的 MSXML 版本不支持此属性?

For a document which has a DOCTPYE declaration like

<!DOCTYPE RootElement SYSTEM "file.dtd">

Delphi 2009, using MSXML, reports that the systemId is empty (""):

Assert(Doc.DOMDocument.doctype.systemId <> ''); // fails!

while

Assert(Doc.DOMDocument.doctype.name = 'RootElement'); // ok

correctly verifies that the DOCTYPE name id "RootElement".

Is this a bug in Delphi (or my code) or am I using a version of MSXML which does not support this property?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一腔孤↑勇 2024-10-02 01:12:29

MSXML 的 DocumentType 实现完全缺少 DocumentType 属性 publicIdsystemIdinternalSubsetMSDN API 参考;缺少的属性在 MS-DOM2CX 中特别指出

如果您需要此信息,您可能必须尝试不同的 DOM 实现。这是一个。如果您可以使用 .NET 类,则 System.Xml 也支持它。

MSXML's DocumentType implementation is completely missing the DocumentType properties publicId, systemId and internalSubset. MSDN api ref; the missing properties are specifically called out in MS-DOM2CX.

If you need this information you might have to try a different DOM implementation. Here's one. If you can use .NET classes, System.Xml supports it too.

放血 2024-10-02 01:12:29

如果 ProhibitDTD 属性为 True 尝试设置它为假。

这是一篇包含更多详细信息的文章

In case ProhibitDTD property is True try setting it to False.

Here's an article with more details.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文