Html Agility Pack/C#: how to create/replace tags?

前端 未结 2 1648
别那么骄傲
别那么骄傲 2021-02-20 03:03

The task is simple, but I couldn\'t find the answer.

Removing tags (nodes) is easy with Node.Remove()... But how to replace them?

There\'s a ReplaceChild() metho

2条回答
  •  被撕碎了的回忆
    2021-02-20 03:29

    Are you sure InnerHtml is a read only property?

    The HTMLAgility pack's documentation says otherwise: (Cut & Paste)

    Gets or Sets the HTML between the start and end tags of the object.
    
    Namespace:  HtmlAgilityPack
    Assembly:  HtmlAgilityPack (in HtmlAgilityPack.dll) Version: 1.4.0.0 (1.4.0.0)
    Syntax
    C# 
    public virtual string InnerHtml { get; set; }
    

    If it is read only could you post some code?

提交回复
热议问题