Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个存储为字符串的样式表,我正在尝试使用 Html Agility Pack 添加到已解析的 HtmlDocument 中。我无法设置style节点的 InnerText,因为它没有设置器。这样做的最佳方法是什么?
style
未经测试,但应该给你的想法:
// doc is the HtmlDocument var style = doc.CreateElement("style"); var text = doc.CreateTextNode("some CSS here"); style.AppendChild(text); doc.DocumentNode.AppendChild(style); // or, AppendChild to any node