public void Parse()
        {
            CssParser parser = new CssParser(_css);

            OnDocumentBegin();
            while (true)
            {
                StyleElement element = parser.Next();

                if (element == null)
                {
                    OnDocumentEnd();
                    return;
                }

                StyleText styleText = element as StyleText;
                if (styleText != null)
                {
                    OnStyleText(styleText);
                }

                StyleLiteral styleLiteral = element as StyleLiteral;
                if (styleLiteral != null)
                {
                    OnStyleLiteral(styleLiteral);
                }

                StyleUrl styleUrl = element as StyleUrl;
                if (styleUrl != null)
                {
                    OnStyleUrl(styleUrl);
                }

                StyleImport styleImport = element as StyleImport;
                if (styleImport != null)
                {
                    OnStyleImport(styleImport);
                }

                StyleComment styleComment = element as StyleComment;
                if (styleComment != null)
                {
                    OnStyleComment(styleComment);
                }
            }
        }
Example #2
0
        private string LowerCaseCss(string val)
        {
            StringBuilder output = new StringBuilder();
            CssParser     parser = new CssParser(val);

            for (StyleElement el; null != (el = parser.Next());)
            {
                if (el is StyleText)
                {
                    output.Append(el.RawText.ToLower(CultureInfo.InvariantCulture));
                }
                else
                {
                    output.Append(el.RawText);
                }
            }
            return(output.ToString());
        }