IDtXmlConsumer.RootNodeName

Syntax

RootNodeName: String;

Description

The RootNodeName property determines root node name.

Example

Executing the example requires that the repository contains an ETL task with the Etl identifier.

Sub Main;

Var

MB: IMetabase;

MObj: IMetabaseObject;

EtlTask: IEtlTask;

EtlConsumer: IEtlPlainDataConsumer;

XMLConsumer: IDtXmlConsumer;

WxConsumer: IWxRectangle;

WxETLConsumer: 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 consumer creation

//Creation of the Export To XML object

EtlConsumer := EtlTask.Create(EtlObjectType.PlainDataXmlConsumer) As IEtlPlainDataConsumer;

EtlConsumer := EtlConsumer.Edit;

EtlConsumer.Id := "XML_Consumer";

EtlConsumer.Name := "Export to XML";

EtlConsumer.Description := "Export to XML";

//Set up data consumer

XMLConsumer := EtlConsumer.Consumer As IDtXmlConsumer;

XMLConsumer.DataNodeName := "Row";

XMLConsumer.File := "c:\Data_out.Xml";

XMLConsumer.FormatType := DtXmlFormatType.FieldsAsNodes;

XMLConsumer.RootNodeName := "Data";

//Save consumer

EtlConsumer.Save;

//End of consumer creation

//Start of visual object creation

WxConsumer := EtlTask.Workspace.CreateRectangle;

WxETLConsumer := New WxETLObject.Create;

WxETLConsumer.ETLObject := EtlConsumer;

WxConsumer.Style.TextPosition := WxTextPosition.Bottom;

WxConsumer.Style.PictureMarginTop := -10;

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

WxConsumer.Extension := WxETLConsumer As IWxShapeExtension;

//End of visual object creation

//Save Etl task

MObj.Save;

End Sub Main;

After executing the example the Export to XML object is created in the ETL task. The consumer exports data into the XML file Data_out.xml. If the file does not exist, it is created.

During export the file turns into:

<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>

See also:

IDtXmlConsumer