XML Mapping Tool Delphi Tokyo

Asked

Viewed 317 times

0

I would like to know the correct way to map an . XML by Delphi Tokyo with xml Mapping tool and read in ClientDataSet.

Using the XML Mapping Tool with the Delphi 7 I can do the mapping and read the files by ClientDataSet no problem.

if OpenDialog1.Execute then
     begin
         XMLTransform1.SourceXmlFile:= OpenDialog1.FileName;
         XMLTransform1.TransformationFile:= ExtractFilePath(ParamStr(0))+ 'transformation.xtr';
         Cds_Fornecedor.XMLData:= XMLTransform1.Data;
     end;

When you cross the line:

Cds_vendor.Xmldata:= Xmltransform1.Data;

Returns the following error:

XML PARSE ERROR:
Reason: The System cannot locate the specified object.

Note: I generated schema.xml and . xtr by Delphi 7 and then managed by Delphi Tokyo

1 answer

0

I read an article on the net that the programmer used the XMLTransformProvider in the Delphi Tokyo instead of using the XMLTransform (equal to Delphi 7). So I changed the component and the code went like this:

 If ClientDataSet1.Active then
    ClientDataSet1.Close;
 ClientDataSet1.providerName:= 'XMLTransformProvider1';

 XMLTransformProvider1.TransformRead.TransformationFile:= 'arquivo.xtr'
 XMLTransformProvider1.XMLDataFile:= OpenDialog1.FileName;
 ClientDataSet1.Active:= True;

I chose to answer my own question instead of erasing it, because I know that if I had this difficulty, for sure, someone else will have it too.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.