예제 #1
0
 public cDOC(string initName, int initId, CheckState initState, string baseUrn, string initTargetNSPrefix, cBIV biv) : base(initName, initId, initState)
 {
     BaseUrn = baseUrn;
     TargetNamespacePrefix = initTargetNSPrefix;
     BIV = biv;
     if (biv.DocL != null && biv.DocL.DocumentRoot != null)
     {
         TargetNamespace = BaseUrn + "-" + biv.DocL.DocumentRoot.Name;
     }
 }
        private void buttonGenerate_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            richtextStatus.Text = "Starting to generate XML schemas ...\n\n";

            GatherUserInput();

            cBIV currentBIV = cache.BIVs[selectedBIVName];

            // TODO: check if path is valid
            IAbie rootAbie = null;
            cDOC  document = currentBIV.DOC;

            if (document != null && document.State == CheckState.Checked)
            {
                rootAbie = cctsR.GetAbieById(document.Id);
            }

            IDocLibrary docl = cctsR.GetDocLibraryById(currentBIV.Id);

            // TODO: xsd generator needs to be adapted - currently all doc libraries are being generated whereas
            // only the ones that are checked should be generated..

            //TODO: currently the wizard just takes the input from the text fields whereas the prefix and the
            // target namespace should be (a) stored in the cache and (b) read from there while generation..
            string targetNamespace   = textTargetNS.Text;
            string namespacePrefix   = textPrefixTargetNS.Text;
            bool   annotate          = checkboxAnnotations.CheckState == CheckState.Checked ? true : false;
            bool   allschemas        = checkboxAllschemas.CheckState == CheckState.Checked ? true : false;
            var    generationContext = new GeneratorContext(cctsR, targetNamespace,
                                                            namespacePrefix, annotate, allschemas,
                                                            outputDirectory, docl);

            generationContext.SchemaAdded += HandleSchemaAdded;
            export.cctsndr.XSDGenerator.GenerateSchemas(generationContext);

            richtextStatus.Text += "\nGenerating XML schemas completed!";
            progressBar.Value    = 100;
            Cursor.Current       = Cursors.Default;
        }