Data integration is one of the main tasks of Enterprise Application Integration. Its main difficulties are:
1. The data source formats vary widely;
2. complicated data conversion process;
3. Non-invasive requirements;
4. Heavy workload;
Based on my development and application experience in data integration, I recommend this data integration solution by referring to some data integration tools on the market:
In the above scheme:
1. The dao_output component outputs the source data in the form of an XML file;
2. The dao_input component parses XML files and stores them in the target database;
3. the compiler is responsible for loading User-Defined XSL style sheet files and converting the source XML file into the target XML file, so that the data conversion process is decoupled from the data conversion logic;
Automation:
1. The source data is output in XML format, which can be automated and unattended (supported by multiple advanced development languages );
2. the XSL file can implement complex custom conversion and programming function extension (http://www.ibm.com/developerworks/cn/xml/x-xsltext? S_tact = 105agx52 & s_cmp = tag-csdn );
3. The target XML can be fully defined as the object serialization format. After the dao_output component assembles the object, it can perform batch storage operations.
Using the C # compiler of Saxon. API: (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
Extends tcompiler compiler = processor. newcomputcompiler ();
// Compile all stylesheets
Effecttransformer 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 ();
}
}
}