示例#1
0
        public static CSSElement ParseStyleString(string css)
        {
            CSSElement result = new CSSElement(null);

            foreach (Match styles in StyleRegex.Matches(css))
            {
                result.Styles.Add(new Style(styles.Groups[1].ToString(), styles.Groups[2].ToString()));
            }

            return(result);
        }
示例#2
0
        private void ParseStyles(string css)
        {
            foreach (Match elem in TopRegex.Matches(css))
            {
                CSSElement styleelement = new CSSElement(elem.Groups[1].ToString());

                foreach (Match styles in StyleRegex.Matches(elem.Groups[2].ToString()))
                {
                    styleelement.Styles.Add(new Style(styles.Groups[1].ToString(), styles.Groups[2].ToString()));
                }

                Elements.Add(styleelement);
            }
        }