/// <summary> /// Parses the action. /// </summary> /// <param name="node">The node to parse.</param> /// <param name="config">The rewriter configuration.</param> /// <returns>The parsed action, null if no action parsed.</returns> public override IRewriteAction Parse(XmlNode node, object config) { ConditionalAction rule = new ConditionalAction(); // Process the conditions on the element. bool negative = (node.LocalName == Constants.ElementIfNot); ParseConditions(node, rule.Conditions, negative, config); // Process attribute-based actions. ReadAttributeActions(node, false, rule.Actions, (RewriterConfiguration)config); // Next, process the nested <if> and <ifnot> and non-final actions. ReadActions(node, false, rule.Actions, (RewriterConfiguration)config); // Finish off with any final actions. ReadAttributeActions(node, true, rule.Actions, (RewriterConfiguration)config); ReadActions(node, true, rule.Actions, (RewriterConfiguration)config); return rule; }
/// <summary> /// Parses the action. /// </summary> /// <param name="node">The node to parse.</param> /// <param name="config">The rewriter configuration.</param> /// <returns>The parsed action, null if no action parsed.</returns> public override IRewriteAction Parse(XmlNode node, RewriterConfiguration config) { if (node == null) { throw new ArgumentNullException("node"); } if (config == null) { throw new ArgumentNullException("config"); } var rule = new ConditionalAction(); // Process the conditions on the element. bool negative = (node.LocalName == Constants.ElementUnless); ParseConditions(node, rule.Conditions, negative, config); // Next, process the actions on the element. ReadActions(node, rule.Actions, config); return rule; }