16,748
社区成员
发帖
与我相关
我的任务
分享
var i:integer;
begin
XMLDocument1.XML.Clear;
XMLDocument1.Active:= True; // 必须先激活
XMLDocument1.Version:='1.0'; // 设置版本
XMLDocument1.Encoding:='GB2312'; // 设置字符集
RootName:='ASDFGH';
MyList1.clear;
MyList2.clear;
MyList1.Add('A'); // 加入属性名
MyList2.Add('1111'); // 加力属性值
MyList1.Add('B');
MyList2.Add('2222');
MyList1.Add('C');
MyList2.Add('3333');
MyList1.Add('D');
MyList2.Add('4444');
Root:=XMLDocument1.AddChild(RootName); // 加入根节点 Node指向根节点
for i:=0 to MyList1.Count-1 do // 加入根节点属性
Root.SetAttribute(MyList1.Strings[i],MyList2.Strings[i]);