Example #1
0
        private void buttonTransform_Click(object sender, EventArgs e)
        {
            string srcFile = this.textBoxSource.Text.Trim();
            string xslFile = this.textBoxXSLT.Text.Trim();
            string tarFile = string.Format("{0}.transformed.xml", srcFile);

            XMLTransformer transformer = XMLTransformer.CreateFromFile(xslFile);

            if (transformer.TransformFile(srcFile, tarFile))
            {
                MessageBox.Show("Success");
            }
            else
            {
                MessageBox.Show(this, XMLTransformer.LastErrorInfor);
            }
        }
Example #2
0
        private void buttonTransform_Click(object sender, EventArgs e)
        {
            string source = this.textBoxSource.Text.Trim();
            string xslt   = this.textBoxXSLT.Text.Trim();
            string target = "";

            XMLTransformer transformer = XMLTransformer.CreateFromString(xslt);

            DateTime dtBegin = DateTime.Now;
            bool     res     = (transformer != null && transformer.TransformString(source, ref target));
            DateTime dtEnd   = DateTime.Now;
            TimeSpan sp      = dtEnd.Subtract(dtBegin);

            this.labelPerform.Text = sp.TotalMilliseconds.ToString() + "ms";

            if (res)
            {
                this.textBoxTarget.Text = target;
            }
            else
            {
                MessageBox.Show(this, XMLTransformer.LastErrorInfor);
            }
        }