Example #1
0
 public TemplatePlatformEmitter(string templateName)
 {
     _templateName = templateName;
     _template = _templateManager[_templateName];
     if (_template.MapDictionary != null && _template.MapDictionary.Count > 0)
     {
         _templateParameters = new string[_template.MapDictionary.Count];
     }
 }
Example #2
0
        public void AddTemplateFile(XmlReader templateXmlReader)
        {
            var templateDocument = new XmlDocument();
            templateDocument.Load(templateXmlReader);

            ////MessageEngine.Trace(Severity.Debug, "TemplateManager: Validating {0}", fileName);
            templateDocument.Validate(Settings_ValidationEventHandler);
            MessageEngine.Trace(Severity.Debug, "TemplateManager: Validation Succeeded");

            XPathNavigator templateNavigator = templateDocument.CreateNavigator();

            var templateNamespaceManager = new XmlNamespaceManager(templateNavigator.NameTable);
            templateNamespaceManager.AddNamespace("tm", "http://schemas.microsoft.com/detego/2007/07/07/VulcanTemplate.xsd");

            foreach (XPathNavigator nav in templateNavigator.Select("//tm:Templates/tm:Template", templateNamespaceManager))
            {
                string templateName = nav.SelectSingleNode("@Name").Value.Trim();
                string templateData = nav.SelectSingleNode("tm:TemplateData", templateNamespaceManager).Value.Trim();
                string templateType = nav.SelectSingleNode("@Type").Value.Trim();

                var t = new Template(templateName, templateType, templateData);
                MessageEngine.Trace(Severity.Debug, "Adding template " + templateName);

                if (templateType == "XMLTemplate")
                {
                    MessageEngine.Trace(Severity.Debug, "{0} is an XML Template", templateName);
                }

                foreach (XPathNavigator mapNav in nav.Select("tm:Map", templateNamespaceManager))
                {
                    string source = mapNav.SelectSingleNode("@Source").Value;
                    int index = mapNav.SelectSingleNode("@Index").ValueAsInt;
                    MessageEngine.Trace(Severity.Debug, "Mapping input {0} to outputPathIndex {1}", source, index);
                    t.MapDictionary.Add(source, index);
                }

                _templateDictionary.Add(templateName, t);
            }
        }
Example #3
0
 public void AddTemplate(string templateName, Template template)
 {
     _templateDictionary.Add(templateName, template);
 }