如何使用 Delphi 读取 DOCTYPE SYSTEM 标识符?
对于像 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
MSXML 的 DocumentType 实现完全缺少 DocumentType 属性
publicId
、systemId
和internalSubset
。 MSDN API 参考;缺少的属性在 MS-DOM2CX 中特别指出。如果您需要此信息,您可能必须尝试不同的 DOM 实现。这是一个。如果您可以使用 .NET 类,则 System.Xml 也支持它。
MSXML's DocumentType implementation is completely missing the DocumentType properties
publicId
,systemId
andinternalSubset
. 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.
如果 ProhibitDTD 属性为 True 尝试设置它为假。
这是一篇包含更多详细信息的文章。
In case ProhibitDTD property is True try setting it to False.
Here's an article with more details.