示例#1
0
        public static void ImportXml(string xmlFileName, string outputstring)
        {
            try
            {
                TraceTargetConsole  ttc = new TraceTargetConsole();
                eprtrMapToEPRTRxml1 eprtrMapToEPRTRxml1Object = new eprtrMapToEPRTRxml1();
                eprtrMapToEPRTRxml1Object.RegisterTraceTarget(ttc);

                Altova.IO.Input PollutantReleaseAndTransferReport2Source = new Altova.IO.FileInput(xmlFileName);

                eprtrMapToEPRTRxml1Object.Run(
                    PollutantReleaseAndTransferReport2Source,
                    outputstring);
                //"Provider=SQLOLEDB.1; Data Source=sdkcga6306; User ID=sa;Password=tmggis;Initial Catalog=EPRTRxml;Persist Security Info=true;Auto Translate=false;Tag with column collation=false;Use Encryption for Data=false;Mars_Connection=no;");
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#2
0
        private void buttonStart_Click(object sender, System.EventArgs e)
        {
            WriteTrace("eprtr started...");

            try
            {
                eprtrMapToEPRTRxml1 eprtrMapToEPRTRxml1Object = new eprtrMapToEPRTRxml1();
                eprtrMapToEPRTRxml1Object.RegisterTraceTarget(this);
                eprtrMapToEPRTRxml1Object.Run(
                    textBoxSource0.Text,
                    textBoxTarget0.Text
                    );
            }
            catch (Exception err)
            {
                WriteTrace("ERROR: ");
                WriteTrace(err.Message);
                WriteTrace(err.StackTrace);
            }

            WriteTrace("eprtr finished.");
        }
示例#3
0
        public static void Main(string[] args)
        {
            Console.Out.WriteLine("eprtr Application");

            try
            {
                TraceTargetConsole  ttc = new TraceTargetConsole();
                eprtrMapToEPRTRxml1 eprtrMapToEPRTRxml1Object = new eprtrMapToEPRTRxml1();
                eprtrMapToEPRTRxml1Object.RegisterTraceTarget(ttc);


                // run mapping
                //
                // you have different options to provide mapping input and output:
                //
                // files using file names (available for XML, text, and Excel):
                //   Altova.IO.FileInput(string filename)
                //   Altova.IO.FileOutput(string filename)
                //
                // streams (available for XML, text, and Excel):
                //   Altova.IO.StreamInput(System.IO.Stream stream)
                //   Altova.IO.StreamOutput(System.IO.Stream stream)
                //
                // strings (available for XML and text):
                //   Altova.IO.StringInput(string content)
                //   Altova.IO.StringOutput(StringBuilder content)
                //
                // Java IO reader/writer (available for XML and text):
                //   Altova.IO.ReaderInput(System.IO.TextReader reader)
                //   Altova.IO.WriterOutput(System.IO.TextWriter writer)
                //
                // DOM documents (for XML only):
                //   Altova.IO.DocumentInput(System.Xml.XmlDocument document)
                //   Altova.IO.DocumentOutput(System.Xml.XmlDocument document)
                //
                // By default, Run will close all inputs and outputs. If you do not want this,
                // set the following property:
                // eprtrMapToEPRTRxml1Object.CloseObjectsAfterRun = false;

                {
                    Altova.IO.Input PollutantReleaseAndTransferReport2Source = new Altova.IO.FileInput("C:/1_Projekter/6_E-PRTR/XML-import/TC_ok.xml");

                    eprtrMapToEPRTRxml1Object.Run(
                        PollutantReleaseAndTransferReport2Source,
                        "Provider=SQLOLEDB.1; Data Source=sdkcga6306; User ID=sa;Password=tmggis;Initial Catalog=EPRTRxml;Persist Security Info=true;Auto Translate=false;Tag with column collation=false;Use Encryption for Data=false;Mars_Connection=no;");
                }



                Console.Out.WriteLine("Finished");
            }
            catch (Altova.UserException ue)
            {
                Console.Out.Write("USER EXCEPTION: ");
                Console.Out.WriteLine(ue.Message);
                System.Environment.Exit(1);
            }
            catch (Exception e)
            {
                Console.Out.Write("ERROR: ");
                Console.Out.WriteLine(e.Message);
                Console.Out.WriteLine(e.StackTrace);
                System.Environment.Exit(1);
            }
        }