protected HtmlElementResult ConvertElement(HtmlElementRule parent, XmlElement element)
        {
            Precondition.Require(element, () => Error.ArgumentNull("element"));
            HtmlElementRule    rule    = GetElementRule(parent, element.LocalName);
            HtmlElementContext context = new HtmlElementContext(rule.Clone(), Parameters);

            if (rule.HasConverter)
            {
                element = rule.Converter(context, element);
                if (element == null)
                {
                    return(null);
                }

                if (!MatchName(element, context.Rule))
                {
                    rule = GetElementRule(parent, element.LocalName);
                }

                if ((rule.Options & HtmlElementOptions.Generated) == HtmlElementOptions.Generated)
                {
                    rule          = rule.Clone();
                    rule.Options |= HtmlElementOptions.Allowed;
                }
            }
            return(new HtmlElementResult(element, rule));
        }
		protected HtmlElementResult ConvertElement(HtmlElementRule parent, XmlElement element)
		{
			Precondition.Require(element, () => Error.ArgumentNull("element"));
			HtmlElementRule rule = GetElementRule(parent, element.LocalName);
			HtmlElementContext context = new HtmlElementContext(rule.Clone(), Parameters);

			if (rule.HasConverter)
			{
				element = rule.Converter(context, element);
				if (element == null)
					return null;

				if (!MatchName(element, context.Rule))
					rule = GetElementRule(parent, element.LocalName);

				if ((rule.Options & HtmlElementOptions.Generated) == HtmlElementOptions.Generated)
				{
					rule = rule.Clone();
					rule.Options |= HtmlElementOptions.Allowed;
				}
			}
			return new HtmlElementResult(element, rule);
		}