IDtXmlProvider.File

Syntax

File: String;

Description

The File property determines the path and the name of the text file from which the data is imported.

Example

Executing the example requires that the repository contains an ETL task with the Etl identifier, and the XML file Data.xml in the disk C root directory.

Suppose that the file has the following structure:

<Data>

<Row>

<I_FIELD>10</I_FIELD>

<D_FIELD>10.4</D_FIELD>

<S_FIELD>A</S_FIELD>

<DATE_FIELD>01.01.2006</DATE_FIELD>

<B_FIELD>0</B_FIELD>

</Row>

<Row>

<I_FIELD>20</I_FIELD>

<D_FIELD>24.4</D_FIELD>

<S_FIELD>B</S_FIELD>

<DATE_FIELD>01.02.2006</DATE_FIELD>

<B_FIELD>1</B_FIELD>

</Row>

....

</Data>

Sub Main;

Var

MB: IMetabase;

MObj: IMetabaseObject;

EtlTask: IEtlTask;

EtlProvider: IEtlPlainDataProvider;

XMLProvider: IDtXMLProvider;

WxProvider: IWxRectangle;

WxETLProvider: IWxETLObject;

Begin

MB := MetabaseClass.Active;

//ETL task search. Repository object with the ETL identifier

MObj := MB.ItemById("Etl").Edit;

EtlTask := MObj As IEtlTask;

//Start of the provider creation

//The Import From XML object creation

EtlProvider := EtlTask.Create(EtlObjectType.PlainDataXMLProvider) As IEtlPlainDataProvider;

EtlProvider := EtlProvider.Edit;

EtlProvider.Id := "XML_Provider";

EtlProvider.Name := "Import from XML";

EtlProvider.Description := "Import from XML";

//Set up data provider

XMLProvider := EtlProvider.Provider As IDtXMLProvider;

XMLProvider.File := "c:\Data.xml";

XMLProvider.FormatType := DtXmlFormatType.FieldsAsNodes;

XMLProvider.XPath := "Data/Row";

XMLProvider.FieldsFromFile;

EtlProvider.FillDefault;

//Save data provider

EtlProvider.Save;

//End of provider creation

//Start of visual object creation

WxProvider := EtlTask.Workspace.CreateRectangle;

WxETLProvider := New WxETLObject.Create;

WxETLProvider.ETLObject := EtlProvider;

WxProvider.Style.TextPosition := WxTextPosition.Bottom;

WxProvider.Style.PictureMarginTop := -10;

WxProvider.PinPosition := New GxPointF.Create(50, 50);

WxProvider.Extension := WxETLProvider As IWxShapeExtension;

//End of visual object creation

//Save Etl task

MObj.Save;

End Sub Main;

After executing the example the Import from XML object is created in the ETL task. The provider imports data from the Data.xml XML file. Field values are taken from the child nodes of the Row node.

See also:

IDtXmlProvider