I've just installed Delphi 7 for Personal Use and I'm trying to convert a delphi ClientDataSet file to dfXMLUTF8. All I really need is the xml structure. This site suggests that running 4 lines of code will generate the output I desire. Note however that My file is .cds, not .dat as in the example. I don't know if this makes a difference.
ClientDataSet1.Active := false;
ClientDataSet1.CreateDataSet;
ClientDataSet1.LoadFromFile('MyBinaryFile.dat');
ClientDataSet1.SaveToFile('MyXMLFile.XML', dfXMLUTF8);
I'm receiving errors and since I've never really used Delphi before and I'm hoping somebody who knows what they are doing could just post the very short xml structure for me. Here's the file(486 bytes) I'm working with. I will award correct answer to the first poster with full dfXMLUTF8 output. Thanks!
Update:
Okay I just started the project from scratch and I think I have it somewhat setup. I have added uses DBClient;
, var ClientDataSet1: TClientDataSet
, and lastly the procedure:
ClientDataSet1.LoadFromFile('C:\Documents and Settings\XPMUser\Desktop\DelphiCDS\Master.cds');
ClientDataSet1.SaveToFile('C:\Documents and Settings\XPMUser\Desktop\DelphiCDS\output.XML', dfXMLUTF8);
It throws the following error:
Access violation at address 004588B6 in module 'Project.exe'. Read of address 00000000.
Update2:
Here's what I ended up with:
unit Script3;
interface
uses
Forms, DBClient;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
end;
var
Form1: TForm1;
CDS: TClientDataSet;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
CDS := TClientDataSet.Create(nil);
try
CDS.LoadFromFile('.\input.cds');
CDS.SaveToFile('.\output.xml', dfXMLUTF8);
finally
CDS.Free;
end;
end;
end.