Html Agility Pack - Remove element, but not innerHtml

后端 未结 10 1938
予麋鹿
予麋鹿 2021-01-06 11:46

I can easily remove the element just by note.Remove() lik this:

HtmlDocument html = new HtmlDocument();

html.Load(Server.MapPath(@\"~\\Site\\themes\\default         


        
10条回答
  •  隐瞒了意图╮
    2021-01-06 12:01

    There is a simple way:

     element.InnerHtml = element.InnerHtml.Replace("
    ", "{1}"); var innerTextWithBR = element.InnerText.Replace("{1}", "
    ");

提交回复
热议问题