Quantcast
Channel: htmlagilitypack Forum Rss Feed
Viewing all articles
Browse latest Browse all 655

New Post: InnerHtml works wrong!!!

$
0
0
i wirte some code in LINQPad:
void Main()
{
    var html = new HtmlDocument();
    html.OptionAutoCloseOnEnd = true;
    html.OptionWriteEmptyNodes = true;  
    html.OptionFixNestedTags = true;

    html.LoadHtml("<br />");
    html.DocumentNode.WriteContentTo().Dump();
    
    html.DocumentNode.InnerHtml = "<br />";
    html.DocumentNode.WriteContentTo().Dump();
}
output:
<br />
<br>
i changed the default options of the HtmlDocument, and i want the result is "<br />".
but with "InnerHtml" the result is "<br>", this isn't what i want.

why ?

i use ilspy to read the source code of InnerHtml :
public virtual string InnerHtml
{
    get...
    set
    {
        HtmlDocument doc = new HtmlDocument();
        doc.LoadHtml(value);
        this.RemoveAllChildren();
        this.AppendChildren(doc.DocumentNode.ChildNodes);
    }
}
it create a HtmlDocument object with default options, so the result is wrong!

i hope this will be fixed with the next release!

Viewing all articles
Browse latest Browse all 655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>