public PostTreeIconExtension ParseIcon(string str) { if (string.IsNullOrWhiteSpace(str)) { return null; } try { var html = new HtmlDocument(); html.LoadHtml(str); var result = html .WalkTemplate(obj => obj.DocumentNode) .WalkTemplate(obj => obj.FirstNonTextChild()) .WalkTemplate(obj => obj.Name.EqualsNc("img"), obj => obj) .WalkTemplate( obj => obj.GetAttributeValue("src", null) != null && obj.GetAttributeValue("title", null) != null, obj => new PostTreeIconExtension() { Uri = obj.GetAttributeValue("src", null), Description = obj.GetAttributeValue("title", null) }); return result; } catch { return null; } }