Пример #1
0
        public static EnumContentModel GetContentModel(Element element)
        {
            if (element.tagName == "html")
            {
                return(EnumContentModel.root);
            }
            else if (element.tagName == "body")
            {
                return(EnumContentModel.body);
            }
            else if (ContentModel.MetaList.Contains(element.tagName))
            {
                return(EnumContentModel.metadata);
            }
            else if (SectionList.Contains(element.tagName))
            {
                return(EnumContentModel.section);
            }
            else if (element.tagName == "div" && (element.hasAttribute("class") || element.hasAttribute("id")))
            {
                // when a div has a class or id, it upgraded to a section element.
                return(EnumContentModel.section);
            }
            else if (GroupingList.Contains(element.tagName))
            {
                return(EnumContentModel.grouping);
            }
            else if (TextList.Contains(element.tagName))
            {
                return(EnumContentModel.text);
            }
            else if (EmbeddedList.Contains(element.tagName))
            {
                return(EnumContentModel.embedded);
            }
            else if (TableList.Contains(element.tagName))
            {
                return(EnumContentModel.table);
            }

            else if (FormList.Contains(element.tagName))
            {
                return(EnumContentModel.form);
            }
            else if (Interactive.Contains(element.tagName))
            {
                return(EnumContentModel.interactive);
            }
            else if (Edit.Contains(element.tagName))
            {
                return(EnumContentModel.edit);
            }
            else
            {
                return(EnumContentModel.unknown);
            }
        }