Example #1
0
        public static string ResolveEntities(string html)
        {
            StringBuilder stringBuilder = new StringBuilder(html);

            HtmlEntityResolver.ResolveEntities(stringBuilder);
            return(stringBuilder.ToString());
        }
 private void ParseCssStyle(string cssStyles)
 {
     string[] array = cssStyles.Split(new char[1]
     {
         ';'
     }, StringSplitOptions.RemoveEmptyEntries);
     this.m_parsedCssStyleValues = new Dictionary <string, string>(array.Length, StringEqualityComparer.Instance);
     foreach (string text in array)
     {
         string text2 = string.Empty;
         string html  = string.Empty;
         int    num   = text.IndexOf(':');
         if (num == -1)
         {
             text2 = text.Trim();
         }
         else if (num > 0)
         {
             text2 = text.Substring(0, num).Trim();
             if (num + 1 < text.Length)
             {
                 html = text.Substring(num + 1).Trim();
             }
         }
         if (!string.IsNullOrEmpty(text2))
         {
             this.m_parsedCssStyleValues[text2.ToLowerInvariant()] = HtmlEntityResolver.ResolveEntities(html).ToLowerInvariant();
         }
     }
 }
        private void ReadTextElement()
        {
            int  position = this.m_htmlReader.Position;
            bool flag     = default(bool);

            this.m_sb = this.ReadTextContent(false, out flag);
            if (flag)
            {
                HtmlEntityResolver.ResolveEntities(this.m_sb);
            }
            this.m_currentElement = new HtmlElement(HtmlElement.HtmlNodeType.Text, HtmlElement.HtmlElementType.None, this.m_sb.ToString(), position);
        }
 private void ParseAttributes()
 {
     if (this.m_attributesAsString != null)
     {
         MatchCollection matchCollection = HtmlElement.m_AttributeRegEx.Matches(this.m_attributesAsString.Trim());
         if (matchCollection.Count > 0)
         {
             this.m_parsedAttributes = new Dictionary <string, string>(matchCollection.Count, StringEqualityComparer.Instance);
             for (int i = 0; i < matchCollection.Count; i++)
             {
                 Match  match = matchCollection[i];
                 string text  = null;
                 string html  = null;
                 System.Text.RegularExpressions.Group group = match.Groups["name"];
                 if (group.Length > 0)
                 {
                     text  = group.Value;
                     group = match.Groups["quotedvalue"];
                     if (group.Length > 0)
                     {
                         html = group.Value;
                     }
                     else
                     {
                         group = match.Groups["singlequotedvalue"];
                         if (group.Length > 0)
                         {
                             html = group.Value;
                         }
                         else
                         {
                             group = match.Groups["value"];
                             if (group.Length > 0)
                             {
                                 html = group.Value;
                             }
                         }
                     }
                     this.m_parsedAttributes[text.ToLowerInvariant()] = HtmlEntityResolver.ResolveEntities(html);
                 }
             }
         }
     }
     this.m_attributesAsString = null;
 }