Data Integration解決方案探討

來源:互聯網
上載者:User

 Data Integration是公司專屬應用程式整合中的主要工作內容之一,其主要痛點在於:

1.資料來源格式千差萬別;

2.資料轉換過程複雜;

3.要求非侵入性;

4.工作量龐大;

筆者結合自己在Data Integration方面的開發和應用經驗,參考市場上部分Data Integration工具產品,推薦本Data Integration解決方案,供同行探討:

上述方案中:

1.DAO_output組件負責將來源資料以xml檔案的形式輸出;

2.DAO_input組件負責將xml檔案解析後儲存到目標資料庫中;

3.Compiler編譯器負責將使用者定義的xsl樣式表檔案載入,並將源xml檔案轉換成目標xml檔案,實現資料轉換過程與資料轉換邏輯的解耦合;

自動化方面:

1.來源資料以xml形式輸出,可實現自動化和無人值守(多種進階開發語言支援);

2.xsl檔案能夠實現複雜的自訂轉換及編程功能擴充(http://www.ibm.com/developerworks/cn/xml/x-xsltext/?S_TACT=105AGX52&S_CMP=tag-csdn);

3.目標xml完全可以定義為對象序列化格式,直接由DAO_output組件進行對象組裝後實現批量儲存操作.

採用Saxon.Api的C#編譯器實現:(Saxon.Api:http://www.saxonica.com/index.html)

 

using System;
using System.Text;
using Saxon.Api;
namespace Design
{
    class Sample
    {
        public Sample()
        {
            try
            {
                // Create a Processor instance.
                Processor processor = new Processor();
                // Load the source document
                XdmNode input = processor.NewDocumentBuilder().Build(new Uri(@"D:/DAI/Project/bin/Debug/books.xml"));
                // Create a compiler
                XsltCompiler compiler = processor.NewXsltCompiler();
                // Compile all stylesheets
                XsltTransformer transformer = compiler.Compile(new Uri(@"D:/DAI/Project/bin/Debug/books-csv.xsl")).Load();
                // Now run them in series
                //XdmDestination results1 = new XdmDestination();
                transformer.InitialContextNode = input;
                XdmDestination results = new XdmDestination();
                transformer.Run(results);
                Console.WriteLine("After phase:");
                Console.WriteLine(results.XdmNode.OuterXml);
            }
            catch (DynamicError e)
            {
                Console.WriteLine(e.Message);
                //e.ErrorCode;
                //e.IsWarning;
                //e.LineNumber;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        static void Main()
        {
            Sample s = new Sample();
            Console.Read();
        }
    }
 }

 

 

 

 

 

 

 

 

 

 

 

 

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.