I have a template editor page in a .net MVC application.
I want it to parse HTML and than display the proper styling on a save.
Should I use HTML agility pack?
What is some C# code for the button save to initiate the parse? How do I pass the user defined HTML to the save method within the controller?
Would one example be (In TemplateController):
I want it to parse HTML and than display the proper styling on a save.
Should I use HTML agility pack?
What is some C# code for the button save to initiate the parse? How do I pass the user defined HTML to the save method within the controller?
Would one example be (In TemplateController):
public void Save()
{
HtmlDocument document = new HtmlDocument();
string htmlString = "<html>blabla</html>";
document.LoadHtml(htmlString);
HtmlNodeCollection collection = document.DocumentNode.SelectNodes("//a");
foreach (HtmlNode link in collection)
{
string target = link.Attributes["href"].Value;
}
}