static ElementFactory() { // Create converters Converters.Add(HTMLElementType.FrameSet, new ElementConvertor()); Converters.Add(HTMLElementType.HTML5, new ElementConvertor()); Converters.Add(HTMLElementType.Strict, new ElementConvertor()); Converters.Add(HTMLElementType.Transitional, new ElementConvertor()); Converters.Add(HTMLElementType.XHTML11, new ElementConvertor()); Converters.Add(HTMLElementType.XHTML5, new ElementConvertor()); // initialize converters Assembly currentAssembly = Assembly.GetAssembly(typeof(ElementFactory)); Type[] types = currentAssembly.GetTypes(); foreach (var type in types) { if (type.GetInterface(typeof(IHTMLItem).ToString()) != null) { var attributes = (HTMLItemAttribute[])type.GetCustomAttributes(typeof(HTMLItemAttribute), false); if (attributes.Length > 0) { HTMLElementType compatibilityMask = attributes[0].SupportedStandards; if (compatibilityMask.HasFlag(HTMLElementType.FrameSet)) { Converters[HTMLElementType.FrameSet].AddElement(attributes[0].ElementName, type); } if (compatibilityMask.HasFlag(HTMLElementType.HTML5)) { Converters[HTMLElementType.HTML5].AddElement(attributes[0].ElementName, type); } if (compatibilityMask.HasFlag(HTMLElementType.Strict)) { Converters[HTMLElementType.Strict].AddElement(attributes[0].ElementName, type); } if (compatibilityMask.HasFlag(HTMLElementType.Transitional)) { Converters[HTMLElementType.Transitional].AddElement(attributes[0].ElementName, type); } if (compatibilityMask.HasFlag(HTMLElementType.XHTML11)) { Converters[HTMLElementType.XHTML11].AddElement(attributes[0].ElementName, type); } } } } }