需要TXMLDocument,
给你一个例子:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, xmldom, XMLIntf, StdCtrls, msxmldom, XMLDoc, ComCtrls;
type
TForm1 = class(TForm)
XMLDocument1: TXMLDocument;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
BC,C: olevariant;
h:longint;
begin
xmldocument1.Active:=true;
edit1.Text:=xmldocument1.DocumentElement.NodeValue;//['speakword'];
C:=xmldocument1.DocumentElement.Attributes['color'];
BC:=XMLDOCUMENT1.DocumentElement.Attributes['background-color'];
edit2.Text:=c;
h:=strtoint('0x'+c);
EDIT1.Font.Color:=H;
h:=strtoint('0x'+bc);
edit1.Color:=h;
//-----------------------
//richedit1.Lines.Append(edit1.Text);
end;
end.