<?xml version="1.0" encoding="utf-8" standalone="yes"?> <XmlDestination> <DataRow> <ProductKey>352</ProductKey> <CustomerKey>12232</CustomerKey> <Freight>51,7855</Freight> <CarrierTrackingNumber /> <CustomerPONumber /> </DataRow> <DataRow> <ProductKey>482</ProductKey> <CustomerKey>17628</CustomerKey> <Freight>0,2248</Freight> <CarrierTrackingNumber /> <CustomerPONumber /> </DataRow> <DataRow> <ProductKey>596</ProductKey> <CustomerKey>12763</CustomerKey> <Freight>13,4998</Freight> <CarrierTrackingNumber /> <CustomerPONumber /> </DataRow> <XmlDestination>
using System; using System.Collections.Generic; using System.Text; using System.Collections; using System.Diagnostics; using System.Xml; /* ce namespace contient des classes utilitaires pour la gestion de l'objet */ /* vous le retrouver dans l'archive de l'article */ using BILab.Technical.ETL.Pipeline.Common; using Microsoft.SqlServer.Dts.Pipeline; using Microsoft.SqlServer.Dts.Pipeline.Wrapper; using Microsoft.SqlServer.Dts.Runtime; using Microsoft.SqlServer.Dts.Runtime.Wrapper; [DtsPipelineComponent( ComponentType=ComponentType.DestinationAdapter, DisplayName="XML Destination Adapter", UITypeName = "BILab.Technical.ETL.Pipeline.XmlDestination.XmlDestinationAdapterUI, XmlDestination, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e4e8dcd3244436f2" ) ] public class XmlDestinationAdapter : PipelineComponent { // Methods public XmlDestinationAdapter(); public override void ProvideComponentProperties(); public override DTSValidationStatus Validate(); public override void PreExecute(); public override void PostExecute(); public override void ProcessInput(int inputID, PipelineBuffer buffer); // Properties public bool DoOutputNumberOfRows { get; set; } private string FileName { get; set; } private int LineCounter { get; set; } private XmlWriter Xml { get; set; } private string Xml_NbOfRowsTag { get; set; } private string Xml_RootTag { get; set; } private string Xml_RowTag { get; set; } // Fields private bool _doOutputNumberOfRows; private string _fileName; private int _lineCounter; private XmlWriter _xml; private string _Xml_NbOfRowsTag; private string _Xml_RootTag; private string _Xml_RowTag; private ColumnInformation[] colInfos; private const string Const_FileName_AttributeName = "Filename"; private const string Const_OutputNbOfRows_AttributeName = "Output Number Of Rows"; private const string Const_XmlNbOfRowsTag_AttributeName = "Xml Number of Rows Tag"; private const string Const_XmlRootTag_AttributeName = "Xml Root Tag"; private const string Const_XmlRowTag_AttributeName = "Xml Row Tag"; }