【发布时间】:2018-04-02 13:00:41
【问题描述】:
我正在使用ExCSS 来解析和操作样式表字符串。到目前为止一切顺利。
但我找不到任何关于如何将操纵的样式规则转换为字符串的文档。
虽然代码可能与这个问题无关,但这就是我正在做的:
private string ManipulateCSS(string styles)
{
ExCSS.Parser parser = new ExCSS.Parser();
var stylesheet = parser.Parse(styles);
// here I perform specific manipulations
// which are not relevant to this question...
stylesheet.StyleRules
.SelectMany(r => r.Declarations)
.Where(d => d.Name == "<something>"
...
...
// Now, the next line is where I'm having issues:
// how to return the whole string with styles out of this ExCSS parser?
return stylesheet.StyleRules.ToString();
}
感谢您的帮助!
【问题讨论】:
标签: c# asp.net parsing html-parsing css-parsing