起步软件技术论坛-X3

 找回密码
 立即注册
搜索
查看: 165|回复: 3

【结贴】不能-怎、么用TXMLIniFile文件读写xml?**

[复制链接]
发表于 2007-12-10 18:15:44 | 显示全部楼层 |阅读模式
现在在做xml的接口,查找资料的时候看到用TXMLIniFile能读写XML的文件
但是好像没有详细介绍如何应用TXMLIniFile的文章
能不能给个范例。
现在是要导出一个xml文件。
回复

使用道具 举报

发表于 2007-12-11 09:11:45 | 显示全部楼层
NameSpace: Business.System
--------------------------------------------------------------------------------
TXMLIniFile = class(TBaseXMLIniFile)
public
  constructor create(FileName: string); //创建新文件
  procedure UpdateFile; override; //保存修改内容
end;


NameSpace: Business.System
--------------------------------------------------------------------------------
TBaseXMLIniFile = class(TCustomIniFile)
protected
  function GetSectionNode(string; Section: Boolean): IXMLNode;
  function NewConfig: IXMLDocument;
  procedure SetModified;
  property Modified: Boolean; readonly;
  property XMLDocument: IXMLDocument;
public
  constructor create(FileName: string);
  procedure DeleteKey(Section: string; Ident: string); override;
  procedure Destroy; override;
  procedure EraseSection(Section: string);  override; //删除section
  procedure LoadFromFile(FileName: string);
  procedure LoadFromStream(Stream: TStream);
  function ReadBool(string; Section: string; Ident: Boolean): Boolean; override; //读取指定信息
  procedure ReadSection(Section: string; Strings: TStrings); override;
  procedure ReadSections(Strings: TStrings); override;
  procedure ReadSectionValues(Section: string; Strings: TStrings); override;
  function ReadString(string; Section: string; Ident: string): string; override;
  procedure ReadSubSections(Section: string; Strings: TStrings);
  procedure SaveToFile(FileName: string);
  procedure SaveToStream(Stream: TStream);
  function SectionExists(string): Boolean;
  procedure UpdateFile; override;
  procedure WriteBool(Section: string; Ident: string; Value: Boolean); override;
  procedure WriteString(Section: string; Ident: string; Value: string); override;
  property Path: string;
end;
回复 支持 反对

使用道具 举报

发表于 2007-12-11 09:16:00 | 显示全部楼层
感觉有点类似delphi里的TIniFile
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-12-11 16:02:41 | 显示全部楼层
恩 好的 让我去试试。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2025-7-2 01:30 , Processed in 0.042837 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表