将XML文件写入android

简介:

----formshow

  newpath := '/storage/sdcard0/DCIM/100ANDRO/GRJKDAGLGXYSF';
  if not TDirectory.Exists (newpath) then begin
      TDirectory.CreateDirectory (newpath); //Create a folder
    end;
  newpath := newpath + '/';

----存入本机

var

  filename:string;
   newfile:Tfilestream;

begin

   filename := 'update_sf_' + formatdatetime('yyyy-MM-dd',now) + gxyglkId;
   newfile := TFile.Create (newpath + filename);
   newfile.Free;
   clientdatasetlocal.SaveToFile(newpath + filename,dfXML);

end;

---创建文件

var
  newpath:string;
  newfile:Tfilestream;
begin
  newpath := '/storage/sdcard0/DCIM/100ANDRO/GRJKDAGLF';
  if TFile.Exists (newpath + '/update.xml') then begin
      ShowMessage ('File exists');
    end
    else begin
      newfile := TFile.Create (newpath + '/update.xml'); //Create a file (stream)
      newfile.Free; //Clear Stream
    //  SpeedButton5Click (Self); //Close the window
    //  TotalWork (path, True); //Update the list
    end;


---创建文件路径

var
  newpath:string;
begin
  newpath := '/storage/sdcard0/DCIM/100ANDRO/GRJKDAGLF';
  showmessage(newpath);
  if TDirectory.Exists (newpath) then begin
      ShowMessage ('Folder Exists!');
    end
    else begin
      TDirectory.CreateDirectory (newpath); //Create a folder
      ShowMessage ('Folder created!');
     // SpeedButton5Click (Self); //Close the window
     // TotalWork (path, True); //Update the list
    end;














本文转自鹅倌51CTO博客,原文链接:http://blog.51cto.com/kaixinbuliao/1535172 ,如需转载请自行联系原作者


相关文章
|
3天前
|
XML 数据格式
小米备份descript.xml文件
小米备份descript.xml文件
11 0
|
14天前
|
XML Java 数据库连接
mybatis中在xml文件中通用查询结果列如何使用
mybatis中在xml文件中通用查询结果列如何使用
16 0
|
16天前
|
XML JavaScript 前端开发
xml文件使用及解析
xml文件使用及解析
|
1月前
|
XML C# 数据格式
使用C#操作XML文件
使用C#操作XML文件
11 0
|
1月前
|
Java
java实现遍历树形菜单方法——映射文件VoteTree.hbm.xml
java实现遍历树形菜单方法——映射文件VoteTree.hbm.xml
10 0
|
1月前
|
Kubernetes Cloud Native Java
Activiti 简介以及最新activiti依赖 pom.xml文件(使用时注意对应版本号)
Activiti 简介以及最新activiti依赖 pom.xml文件(使用时注意对应版本号)
39 1
|
1月前
|
XML Java 数据库连接
struts+hibernate+oracle+easyui实现lazyout组件的简单案例——hibernate的config文件(hibernate.cfg.xml)
struts+hibernate+oracle+easyui实现lazyout组件的简单案例——hibernate的config文件(hibernate.cfg.xml)
11 0
|
2月前
|
XML JavaScript 数据格式
打开 XML 文件报错 There is no Unicode byte order mark
打开 XML 文件报错 There is no Unicode byte order mark
43 0
|
2月前
|
XML 存储 数据格式
什么是 XML 文件的 Schema
什么是 XML 文件的 Schema
30 0
|
6天前
|
XML C# 数据格式
C# 解析XML文件
C# 解析XML文件
14 1