放到 project 中 msnmsg.xml
使用 Tools->XML Mapper
File->Open-> msnmsg.xml
在左方 Document 中 Select Message[*]
按右鍵 Select All Children
Create->Datapacket from XML
Create->Transformation
File->Save->Transformation
存到 project 中 ToDp.xtr
在 Form 中加入元件
DataAccess->TXMLTransformProvider
DataAccess->TClientDataSet
DataAccess->TDataSource
Data Controls->TDBGrid
Data Controls->TDBNavigator
在 Form Create 事件中加入
procedure TForm1.FormCreate(Sender: TObject);
begin
DBGrid1.Align := alClient;
DBNavigator1.Align := alBottom;
XMLTransformProvider1.XMLDataFile := 'msnmsg.xml';
XMLTransformProvider1.TransformRead.TransformationFile := 'ToDp.xtr';
ClientDataSet1.ProviderName := 'XMLTransformProvider1';
DataSource1.DataSet := ClientDataSet1;
DBGrid1.DataSource := DataSource1;
DBNavigator1.DataSource := DataSource1;
ClientDataSet1.Active := True;
end;
沒有留言:
張貼留言