delphi xml 添加节点
<?xml version= "1.0 " encoding= "gb2312 "?>
<File>
<aa>
<bb> bb </bb>
</aa>
<Handle> 客户端加密,服务器端解密 </Handle>
<FileId> 文件ID </FileId>
<FileName> 文件名 </FileName>
<FileSize> 文件大小 </FileSize>
<UploadDate> 上传日期 </UploadDate>
<UploadTime> 上传时间 </UploadTime>
<UploadMan> 上传人 </UploadMan>
<Note> 注释 </Note>
</File>
这是Delphi代码
procedure TForm1.Button1Click(Sender: TObject);
var node:IXMLNode;
begin
XMLDocument1.Active:=True;
node:=XMLDocument1.DocumentElement.ChildNodes.First.AddChild( 'tgp1c11 ');
node.Attributes[ 'class ']:= 'class ';
node.Attributes[ 'caption ']:= 'caption ';
node.Attributes[ 'left ']:= 'left ';
node.Attributes[ 'top ']:= 'top ';
node.Attributes[ 'width ']:= 'width ';
node.Text:= 'aaa ';
XMLDocument1.SaveToFile( 'c:\aa.xml ');
end;
下面是产生的XML文件
<?xml version= "1.0 " encoding= "gb2312 "?>
<File>
<aa>
<bb> bb </bb>
<tgp1c11 class= "class " caption= "caption " left= "left " top= "top " width= "width "> aaa </tgp1c11> </aa>
<Handle> 客户端加密,服务器端解密 </Handle>
<FileId> 文件ID </FileId>
<FileName> 文件名 </FileName>
<FileSize> 文件大小 </FileSize>
<UploadDate> 上传日期 </UploadDate>
<UploadTime> 上传时间 </UploadTime>
<UploadMan> 上传人 </UploadMan>
<Note> 注释 </Note>
</File>
转载于:https://www.cnblogs.com/Mr-Xia/archive/2011/09/07/2169922.html
- 点赞
- 收藏
- 分享
- 文章举报
- delphi xml 查找节点
- delphi 中 Record ,packet Record
- Delphi的MessageBox的用法
- Delphi 将DBGrid中的内容导出到Excel
- Delphi把窗体设为bsnone时如何拖动窗体
- Delphi向QQ2011窗口发送登录消息
- delphi编程中的棘手问题;求指教!
- 在DELPHI程序中自动设置ODBC数据源
- Delphi粗边框
- 由Delphi程序改写Sql(2000)的存储过程
- Delphi发email
- 用Delphi 向量算法 判断点是否在线上
- Delphi 删除控件问题
- 继续Delphi调用Wcf
- Delphi 调用WCF 搞定啦
- Quick Report 说明 for delphi 7
- DELPHI7下用superobject读取中国天气网的JSON数据的天气预报
- 刚学 Delphi 请多指教
- delphi学习总结
- Delphi中的记录