开发者

How can I read the DOCTYPE SYSTEM identifier with Delphi?

开发者 https://www.devze.com 2023-01-18 04:53 出处:网络
For a document which has a DOCTPYE declaration like <!DOCTYPE RootElement SYSTEM \"file.dtd\"> Delphi 2009, using MSXML, reports that the systemId is empty (\"\"):

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!

w开发者_StackOverflowhile

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?


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.


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

Here's an article with more details.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号