Exemplo n.º 1
0
        private void menuDestinationGenerateXML_Click(object sender, EventArgs e)
        {
            var node = treeDestinationSchema.SelectedNode;

            if (node.Tag == null || !node.Tag.ToString().StartsWith("XML_ELEMENT"))
            {
                MessageBox.Show("Can only generate XML from element");
                return;
            }
            var xml = XmlService.PrettyPrint(UIService.GenerateXml(node), false);

            Clipboard.SetText(xml);
        }
Exemplo n.º 2
0
 private void menuApplyXSLT_Click(object sender, EventArgs e)
 {
     try
     {
         results.SetText(XmlService.Transform(sourceInstance, xslEditor.Text));
     }
     catch (Exception ex)
     {
         var err = ex.Message;
         ex = ex.InnerException;
         while (ex != null)
         {
             err += Environment.NewLine + ex.Message;
             ex   = ex.InnerException;
         }
         results.SetText(err);
     }
 }
Exemplo n.º 3
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            string error = null;

            if ((InstanceMandatory && !File.Exists(txtInstancePath.Text)) || (File.Exists(txtInstancePath.Text) && !XmlService.ValidateXml(txtInstancePath.Text, ref error)))
            {
                var message = "You must specify a valid XML instance.";
                if (!string.IsNullOrEmpty(error))
                {
                    message += Environment.NewLine + Environment.NewLine + "Additional information: " + error;
                }
                MessageBox.Show(message, "Error");
                return;
            }
            if (!File.Exists(txtSchemaPath.Text) || (File.Exists(txtSchemaPath.Text) && !XmlService.ValidateXml(txtSchemaPath.Text, ref error)))
            {
                var message = "You must specify a valid XML schema.";
                if (!string.IsNullOrEmpty(error))
                {
                    message += Environment.NewLine + Environment.NewLine + "Additional information: " + error;
                }
                MessageBox.Show(message, "Error");
                return;
            }
            XmlSchema    = txtSchemaPath.Text;
            XmlInstance  = txtInstancePath.Text;
            DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Exemplo n.º 4
0
 private void ApplyPrettyPrint()
 {
     xslEditor.Text = XmlService.PrettyPrint(xslEditor.Text);
     xslEditor.Refresh();
 }