Ejemplo n.º 1
0
        public string Provide(XmlConfigRuleContext ruleContext)
        {
            XslTransformRule.Context context = new XslTransformRule.Context();
            context.FileManager = ruleContext.FileManager;
            context.ReadFromXmlNode(ruleContext.RuleConfig);

            string result = Rule.Provide(context);
            // test for result
            XPathNavigator nav       = ruleContext.RuleConfig.CreateNavigator();
            XPathNavigator resultNav = nav.SelectSingleNode("result");

            if (resultNav != null)
            {
                // store result in file
                string resultFileName = resultNav.GetAttribute("file", String.Empty);
                if (!String.IsNullOrEmpty(resultFileName))
                {
                    if (log.IsEnabledFor(LogEvent.Debug))
                    {
                        log.Write(LogEvent.Debug,
                                  new{ Action = "writing transform result to file", Filename = resultFileName });
                    }
                    ruleContext.FileManager.Write(resultFileName, result);
                    result = null;
                }
            }
            return(result);
        }
        public string Provide(XmlConfigRuleContext ruleContext)
        {
            XslTransformRule.Context context = new XslTransformRule.Context();
            context.FileManager = ruleContext.FileManager;
            context.ReadFromXmlNode( ruleContext.RuleConfig );

            string result = Rule.Provide(context);
            // test for result
            XPathNavigator nav = ruleContext.RuleConfig.CreateNavigator();
            XPathNavigator resultNav = nav.SelectSingleNode("result");
            if (resultNav!=null) {
                // store result in file
                string resultFileName = resultNav.GetAttribute("file",String.Empty);
                if (!String.IsNullOrEmpty( resultFileName )) {
                    if (log.IsEnabledFor(LogEvent.Debug))
                        log.Write(LogEvent.Debug,
                            new{Action="writing transform result to file",Filename=resultFileName});
                    ruleContext.FileManager.Write(resultFileName, result);
                    result = null;
                }
            }
            return result;
        }
Ejemplo n.º 3
0
 protected virtual void ProcessRuleNode(XmlNode ruleNode)
 {
     for (int i=0; i<Rules.Length; i++)
         if (Rules[i].NodeName==ruleNode.Name) {
             XmlConfigRuleContext context = new XmlConfigRuleContext(ruleNode, FileManager);
             string res = Rules[i].Provide(context);
             if (!String.IsNullOrEmpty(res)) {
                 InsertXml(ruleNode, res);
             }
         }
 }