如何在Delphi 7中使用MSXML6.0创建TXML文档? [英] How to create a TXML Document using MSXML 6.0 in Delphi 7?
本文介绍了如何在Delphi 7中使用MSXML6.0创建TXML文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Delphi 7发布时,MSXML 6.0还不存在。是否可以将Delphi的TXML文档配置为使用MSXML 6.0而不是旧版本?
推荐答案
将以下代码添加到单位名称uMSXMLVersion或您选择的名称,并将其添加到您的项目USX中
{----------------------------------------------------------------------------
Set Delphi's XMLDocument to use MSXML v6.0
Usage: Include unit in project "uses"-list and Delphi will automatically use
MSXML v6.0 for TXmlDocument.
-----------------------------------------------------------------------------}
unit uMSXMLVersion;
interface
implementation
uses ActiveX, MSXML, MSXMLDOM;
function CreateDOMDocumentEx: IXMLDOMDocument;
const
CLASS_DOMDocument60: TGUID = '{88D96A05-F192-11D4-A65F-0040963251E5}';
begin
Result := nil;
if CoCreateInstance(CLASS_DOMDocument60, nil, CLSCTX_INPROC_SERVER or
CLSCTX_LOCAL_SERVER, IXMLDOMDocument, Result) <> S_OK then
Result := CreateDOMDocument; //call the default implementation
end;
initialization
MSXMLDOMDocumentCreate := CreateDOMDocumentEx;
end.
这篇关于如何在Delphi 7中使用MSXML6.0创建TXML文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文