/// <exclude />
        public static Control AsAspNetControl(this XElement element, IXElementToControlMapper controlMapper)
        {
            Control control;

            if (controlMapper.TryGetControlFromXElement(element, out control) == false)
            {
                if (IsHtmlControlElement(element) || element.Attribute("id") != null)
                {
                    control = new HtmlGenericControl(element.Name.LocalName);
                    control.ClientIDMode = ClientIDMode.Static;
                    CopyAttributes(element, (HtmlControl)control);
                    ExportChildNodes(element.Nodes(), control, controlMapper);
                }
                else
                {
                    XElement copy = CopyWithoutNamespace(element, Namespaces.Xhtml);
                    control = new LiteralControl(copy.ToString());
                }
            }

            return(control);
        }
        /// <exclude />
        public static Control AsAspNetControl(this XElement element, IXElementToControlMapper controlMapper)
        {
            Control control;

            if (controlMapper.TryGetControlFromXElement(element, out control) == false)
            {
                if (IsHtmlControlElement(element) || element.Attribute("id") != null)
                {
                    control = new HtmlGenericControl(element.Name.LocalName);
                    control.ClientIDMode = ClientIDMode.Static;
                    CopyAttributes(element, (HtmlControl)control);
                    ExportChildNodes(element.Nodes(), control, controlMapper);
                }
                else
                {
                    XElement copy = CopyWithoutNamespace(element, Namespaces.Xhtml);
                    control = new LiteralControl(copy.ToString());
                }
            }

            return control;
        }