private ElementNode GetFirstBlockParent(ElementNode current, List <IHtmlSchema> schemas) { foreach (var schema in schemas) { IHtmlElementInfo element = schema.GetElementInfo(current.Name); if (element != null && element.IsPropertyValueEqual(ElementInfoProperty.Block, "true", true)) { return(current); } } if (current.Parent != null) { return(GetFirstBlockParent(current.Parent, schemas)); } return(current); }
public static IEnumerable <string> GetAttributeValue(string elementName, string attributeName) { HtmlSchemaManager mng = new HtmlSchemaManager(); IHtmlSchema schema = mng.GetSchema("http://schemas.microsoft.com/intellisense/html"); IHtmlElementInfo element = schema.GetElementInfo(elementName); if (element != null) { IHtmlAttributeInfo attribute = element.GetAttribute(attributeName); if (attribute != null) { foreach (IHtmlAttributeValueInfo value in attribute.GetValues()) { yield return(value.Value); } } } }