XML(30分)

  • 主题发起人 cuiyingjie
  • 开始时间
C

cuiyingjie

Unregistered / Unconfirmed
GUEST, unregistred user!
我想创建msxml.dll的程序单元并把他加入到控件拦的Activex页上,总是出错,请大侠指教
教,环境为wiondows professional 2000+delphi5
 
msxml.dll不是ActiveX Control,所以不能加入到控件拦的Activex页上
如何使用msxml.dll,请看大名鼎鼎的 Charlie Calvert 的文章。
http://homepages.borland.com/ccalvert/TechPapers/Delphi/XMLSimple/XMLSimple.html
 
我上不去http://homepages.borland.com/ccalvert/TechPapers/Delphi/XMLSimple/XMLSimple.html
,哪位大侠给我发一份,email为cyj@engineer.com.cn,谢谢!
 
谢谢发来文章的大侠!
 
我找不到这个msxml,怎么找也找不到。
 
不用加到delphi中来,直接用就行了。如下代码:
procedure TForm1.Button1Click(Sender: TObject);
var
xmlobj, xslobj: Variant;
sl: TStringList;
begin
sl := TStringList.Create;
xmlobj := CreateOLEObject('MSXML2.DOMDocument');
xmlobj.async := false;
xmlobj.load('page.xml');
xslobj := CreateOLEObject('MSXML2.DOMDocument');
xslobj.async := false;
xslobj.load('dispq_.xsl');
sl.Text := xmlobj.transformNode(xslobj);
sl.SaveToFile('test.txt');
xmlobj := unAssigned;
xslobj := unAssigned;
end;

那个文章有误人之嫌。你在装了msxml的sdk之后,就这样用就行了。
如果是用delphi自己的控件,这么做:
1、在页面上放两个TXmlDocument,分别名为xmldoc、xsldoc,
2、代码如下:
procedure TForm1.Button2Click(Sender: TObject);
var
ws:WideString;
savefile:TextFile;
begin
AssignFile(savefile,'mytest.txt');
Rewrite(savefile);
XmlDoc.LoadFromFile('page.xml');
XmlDoc.Active := true;
XslDoc.LoadFromFile('xslfile.xsl');
XslDoc.Active:= true;
XmlDoc.Node.transformNode(XslDoc.Node,ws);
write(savefile,ws);
CloseFile(savefile);
end;
 

Similar threads

S
回复
0
查看
747
SUNSTONE的Delphi笔记
S
S
回复
0
查看
696
SUNSTONE的Delphi笔记
S
S
回复
0
查看
956
SUNSTONE的Delphi笔记
S
顶部