首 页 ┆ 源码下载 ┆ IT学院 ┆ 字体下载 ┆ 模板下载 ┆ 源码发布 ┆ 广告合作 ┆ 网站地图 ┆ 虚拟主机 ┆ 中文域名
► 设为首页
► 加入收藏
► 联系我们
源码下载 >> ASP源码 | PHP源码 | ASP.net源码 | JSP源码 | CGI源码 | VC/C++源码 | VB源码 | Delphi源码 | Flash源码
文章学院 >> 网络编程 | 网页设计 | 图形图象 | 数据库 | 服务器 | 网络媒体 | 网络安全 | 操作系统 | 办公软件 | 软件开发 | 黑客知识
字体下载 >> 精制字体 | 非英字体 | 艺术字体 | 著名字体 | 哥特式 | 简单字体 | 手写体 | 节假日 | 图案字体 | 精度像素 | 中文字体
模板下载 >> 企业门户 | 数码网络 | 休闲娱乐 | 影视音乐 | 旅游名胜 | 文化艺术 | 电子商务 | 个性展示 | 登陆导航 | Flash模板
►►您当前的位置:源码园 → IT学院 → 软件开发 → Delphi编程 → 文章内容

delphi学习:两种方法使用xml文档

作者:佚名  来源:网上收集  发布时间:2005-12-10 0:20:36
 
使用xml broker, 是delphi 内置的。例: 
  unit ShowXML; 
  interface 
  uses Classes HTTPApp Db DbClient Midas 
 
XMLBrokr WebComp MidItems; 
  type 
  TCustomShow
XMLButton = class(TXMLButton IScriptComponent) 
  protected 
 
XMLMethodName: string; 
  { IScriptComponent } 
  procedure AddElements(AddIntf: IAddScriptElements); 
  function GetSubComponents: TObject; 
  { IWebContent implementation } 
  function ImplContent(Options: TWebContentOptions; 
  ParentLayout: TLayout): string; override; 
  end; 
  TShow
XMLButton = class(TCustomShowXMLButton) 
  public 
  constructor Create(AOwner: TComponent); override; 
  published 
  property Custom; 
  property Style; 
  property StyleRule; 
  property Caption; 
  property
XMLBroker; 
  property
XMLUseParent; 
  end; 
  TShowDeltaButton = class(TCustomShow
XMLButton) 
  public 
  constructor Create(AOwner: TComponent); override; 
  published 
  property Custom; 
  property Style; 
  property StyleRule; 
  property Caption; 
  property
XMLBroker; 
  property
XMLUseParent; 
  end; 
  implementation 
  uses sysutils MidProd; 
  resourcestring 
  sShow
XML = 'Show XML'; 
  sShowDelta = 'Show Delta'; 
  procedure TCustomShow
XMLButton.AddElements( 
  AddIntf: IAddScriptElements); 
  begin 
AddIntf.AddIncludeFile('xmlshow.js'); 
  end; 
  function TCustomShow
XMLButton.GetSubComponents: TObject; 
  begin 
  Result := nil; 
  end; 
  function TCustomShow
XMLButton.ImplContent(Options: TWebContentOptions; 
  ParentLayout: TLayout): string; 
  var 
  Attrs: string; 
  Intf: ILayoutWebContent; 
  FormVarName: string; 
  RowSetVarName: string; 
  begin 
  AddQuotedAttrib(Attrs 'NAME' Name); 
  AddQuotedAttrib(Attrs 'STYLE' Style); 
  AddQuotedAttrib(Attrs 'CLASS' StyleRule); 
  AddQuotedAttrib(Attrs 'VALUE' Self.Caption); 
  AddCustomAttrib(Attrs Custom); 
  if Assigned(
XMLData.XMLBroker) then 
  begin 
  FormVarName :=
XMLData.XMLBroker.SubmitFormVarName; 
  RowSetVarName :=
XMLData.XMLBroker.RowSetVarName(nil); // Row row set var name 
  end; 
  if not (coNoScript in Options.Flags) then 
  Result := 
  Format(''#13#10 
  [Attrs RowSetVarName
XMLMethodName sXMLReadyVar]) 
  else 
  Result := 
  Format(''#13#10 
  [Attrs]); 
  if Assigned(ParentLayout) and ParentLayout.GetInterface(ILayoutWebContent Intf) then 
  Result := Intf.LayoutButton(Result GetLayoutAttributes); 
  end; 
  { TShow
XMLButton } 
  constructor TShow
XMLButton.Create(AOwner: TComponent); 
  begin 
  inherited; 
  DefaultCaption := sShow
XML; 
 
XMLMethodName := 'root'; 
 end; 
  { TShowDeltaButton } 
  constructor TShowDeltaButton.Create(AOwner: TComponent); 
  begin 
  inherited; 
  DefaultCaption := sShowDelta; 
 
XMLMethodName := 'getDelta()'; 
  end; 
  另一种方法使用msxml.dll 如下: 
  .... 
  .... 
  procedure TDHEDForm.OpenBtnClick(Sender: TObject); 
  var 
  pVIn : OleVariant; 
  Prompt : OleVariant; 
  begin 
  pVIn := ''; 
  Prompt := True; 
  DHtmlEdit1.LoadDocument(pVIn Prompt); 
  end; 
  procedure TDHEDForm.SaveBtnClick(Sender: TObject); 
  var 
  vo vb : OleVariant; 
  begin 
  vo := DHTMLEdit1.CurrentDocumentPath; 
  if (vo <> '') then 
  begin 
  vb := false; 
  end 
  else 
  begin 
  vo := ''; 
  vb := true; 
  end; 
  DHTMLEdit1.SaveDocument(vo vb); 
  end; 
  procedure TDHEDForm.SaveAsClick(Sender: TObject); 
  var 
  vo vb : OleVariant; 
  begin 
  vo := ''; 
  vb := true; 
  DHTMLEdit1.SaveDocument(vo vb); 
  end; 
  ...
 

[] [返回上一页] [打 印]
  • 上一篇文章:Delphi与Word之间的融合技术
  • 下一篇文章:Delphi的两个实用技巧(1)播放Flash

  • 相关文章:
  • Java编程中更新XML文档的常用方法
  • [图文]利用Delphi编制IP地址转换器
  • 简析XML及其在Delphi中的应用
  • Delphi模拟最小化恢复关闭按纽
  • Delphi实现远程串口的数据采集
  • [图文]Delphi开发基于DCOM的聊天室
  • 在Delphi中使用电子邮件
  • Delphi托盘编程实战演练
  • Delphi实现同类型文档自动合并
  • Delphi开发98屏幕保护预览程序
  • [图文]Delphi 8 For .NET 抢先预览
  • [图文]用Delphi实现动态获取版本信息
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图 - 源码发布
Copyright © 2003-2009 Ymyasp.Com. All Rights Reserved .
备案序号:粤ICP备07029071号