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 Data.xml file in the root of the C disk.

XML file structure

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    EtlTask: IEtlTask;
    EtlProvider: IEtlPlainDataProvider;
    XMLProvider: IDtXMLProvider;
    WxProvider: IWxRectangle;
    WxETLProvider: IWxETLObject;
Begin
    MB := MetabaseClass.Active;
    // Search for ETL task. Repository object with the "ETL" identifier
    MObj := MB.ItemById("ETL").Edit;
    EtlTask := MObj As IEtlTask;
    // Start of creating a data provider
    // Create the "Import from XML" object
    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 creating a data provider
    // Start of creating a visual object
    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(5050);
    WxProvider.Extension := WxETLProvider As IWxShapeExtension;
    // End of creating a visual object
    // Save ETL task
    MObj.Save;
End Sub UserProc;

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

See also:

IDtXmlProvider