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

New Post: not closing element properly

$
0
0

Blair,

I was running into problem myself. My solution was to add these lines before and after I load the HTML into the document (which is when HtmlAgilityPack actual parses the tree):

 

// HtmlNode.ElementFlags is an app-wide public static (singleton, essentially)// This tell's HtmlAgilityPack to remove the "option" tag's flags.// The flag we are removing is "HtmlElementFlag.Closed".
HtmlElementFlag oldFlags = HtmlNode.ElementsFlags["option"];
HtmlNode.ElementsFlags.Remove("option");

document.LoadHtml(htmlString);
// Or, document.Load(htmlStream);// This part is not necessary, I just like cleaning up after myself.
HtmlNode.ElementsFlags["option"] = oldFlags;
Hope this works out for you!

 


Viewing all articles
Browse latest Browse all 655

Trending Articles



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