我是delphi的新手,现在我必须阅读创建一个xml.我的代码如下:
unit writexml1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, xmldom, XMLIntf, StdCtrls, msxmldom, XMLDoc;
type
TForm1 = class(TForm)
XMLDocument1: TXMLDocument;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.SaveClick(Sender: TObject);
var
rootName: String;
childNode: String;
attrChild: string;
iXml: IDOMDocument;
iRoot, iNode, iNode2, iChild, iAttribute: IDOMNode;
XMLDoc: TXMLDocument;
begin
XMLDoc.Active := False;
XMLDoc.XML.Text := '';
XMLDoc.Active := True;
XMLDoc.SaveToFile('C:\Documents and Settings\a\Desktop\zulfa.xml'); …Run Code Online (Sandbox Code Playgroud)