Exemplo n.º 1
0
        public XLSXWriter(Altova.IO.Output xlsxOutput, XmlDocument doc)
        {
            if (xlsxOutput.Type != Altova.IO.Output.OutputType.Stream)
            {
                throw new System.Exception("XLSX output can be written only into stream");
            }

            targetStream = xlsxOutput.Stream;
            document     = doc;
        }
Exemplo n.º 2
0
        public static void SaveDocument(XmlDocument doc, Altova.IO.Output output, System.Text.Encoding encoding, bool prettyPrint)
        {
            switch (output.Type)
            {
                case Altova.IO.Output.OutputType.Stream:
                    SaveDocument(doc, output.Stream, encoding, prettyPrint);
                    break;

                case Altova.IO.Output.OutputType.Writer:
                    SaveDocument(doc, output.Writer, prettyPrint);
                    break;

                case Altova.IO.Output.OutputType.XmlDocument:
                    break; ;

                default:
                    throw new System.Exception("Unknown output type");
            }
        }
        public void Run(string EPRTRcmsSourceConnectionString, Altova.IO.Output xliff_core_1_2_transitionalTarget)
        {
            mAutoNumberStates = new AutoNumberStateMap();
            // Open the source(s)
            WriteTrace("Connecting to EPRTRcms database...\n");
            try
            {
                m_EPRTRcmsInstance = new System.Data.OleDb.OleDbConnection(EPRTRcmsSourceConnectionString);
                m_EPRTRcmsInstance.Open();
            }
            catch (Exception e)
            {
                throw new DataSourceUnavailableException("Error connecting to database.", e);
            }
            m_Queryloopdbo_xliff_file = Altova.Db.DbTreeOperations.CreateCommand(
                m_EPRTRcmsInstance,
                "SELECT [SourceLanguage], [DataType], [TargetLanguage], [FileID] FROM [dbo].[xliff_file]"
                );
            m_Queryloopdbo_xliff_file.CommandTimeout = 0;
            m_Queryloopdbo_xliff_header_FileID       = Altova.Db.DbTreeOperations.CreateCommand(
                m_EPRTRcmsInstance,
                "SELECT [uid] FROM [dbo].[xliff_header] WHERE [FileID] = ?"
                , System.Data.DbType.Int32);
            m_Queryloopdbo_xliff_header_FileID.CommandTimeout = 0;
            m_Queryloopdbo_xliff_Group_FileID = Altova.Db.DbTreeOperations.CreateCommand(
                m_EPRTRcmsInstance,
                "SELECT [GroupText], [GroupID] FROM [dbo].[xliff_Group] WHERE [FileID] = ?"
                , System.Data.DbType.Int32);
            m_Queryloopdbo_xliff_Group_FileID.CommandTimeout = 0;
            m_Queryloopdbo_xliff_TransID_GroupID             = Altova.Db.DbTreeOperations.CreateCommand(
                m_EPRTRcmsInstance,
                "SELECT [TransIDText], [TransID] FROM [dbo].[xliff_TransID] WHERE [GroupID] = ?"
                , System.Data.DbType.Int32);
            m_Queryloopdbo_xliff_TransID_GroupID.CommandTimeout = 0;
            m_Queryloopdbo_xliff_Value_TransID = Altova.Db.DbTreeOperations.CreateCommand(
                m_EPRTRcmsInstance,
                "SELECT [Source] FROM [dbo].[xliff_Value] WHERE [TransID] = ?"
                , System.Data.DbType.Int32);
            m_Queryloopdbo_xliff_Value_TransID.CommandTimeout = 0;
            m_Queryloopdbo_xliff_Value_TransID2 = Altova.Db.DbTreeOperations.CreateCommand(
                m_EPRTRcmsInstance,
                "SELECT [Target] FROM [dbo].[xliff_Value] WHERE [TransID] = ?"
                , System.Data.DbType.Int32);
            m_Queryloopdbo_xliff_Value_TransID2.CommandTimeout = 0;
            // Create the target

            XmlDocument xliff_core_1_2_transitionalDoc = (xliff_core_1_2_transitionalTarget.Type == Altova.IO.Output.OutputType.XmlDocument) ? xliff_core_1_2_transitionalTarget.Document : new XmlDocument();
            // create processing instruction etc...

            XmlNode xliffTargetObject = xliff_core_1_2_transitionalDoc.CreateElement("xliff", "urn:oasis:names:tc:xliff:document:1.2");

            xliff_core_1_2_transitionalDoc.AppendChild(xliffTargetObject);
            XmlElement xliffTargetEl = (XmlElement)xliffTargetObject;

            xliffTargetEl.SetAttribute("xmlns", "urn:oasis:names:tc:xliff:document:1.2");
            xliffTargetEl.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
            xliffTargetEl.SetAttribute("schemaLocation", "http://www.w3.org/2001/XMLSchema-instance", "urn:oasis:names:tc:xliff:document:1.2 C:/EIONET/CMS_XLIFF/xliff_out/xliff-core-1.2-transitional.xsd");
            xliffTargetEl.SetAttribute("xmlns:xs", "http://www.w3.org/2001/XMLSchema");

            // Execute mapping
            loopdbo_xliff_file(m_EPRTRcmsInstance, xliffTargetObject);

            // Close the target
            XmlTreeOperations.SaveDocument(
                xliff_core_1_2_transitionalDoc,
                xliff_core_1_2_transitionalTarget,
                "UTF-8",
                false,
                false,
                true
                );

            // Close the Source Library
            m_EPRTRcmsInstance.Close();

            if (runDoesCloseAll)
            {
                xliff_core_1_2_transitionalTarget.Close();
            }
        }
Exemplo n.º 4
0
		public static void SaveDocument(XmlDocument doc, Altova.IO.Output output, string encoding, bool bBigEndian, bool bBOM, bool prettyPrint)
        {
            SaveDocument(doc, output, GetEncodingObject(encoding, bBigEndian, bBOM), prettyPrint);
        }