Reputation: 6883
I'm getting a URL and get all of it's content by calling:
CQ dom = ...;
string content = dom.Text();
I'm noticed that the "Text()" method also extracting HTML comments like:
<html>
<body>
<!-- This is comment - Ignore me -->
</body>
</html>
I looking for some option to remove all those comments from code. Something like this:
dom["comment"].remove();
Is this possible?
Thanks
Upvotes: 1
Views: 281
Reputation: 6883
Found the solution.
The creation of the dom should be done like this:
CQ.Create(stream, Encoding.UTF8, HtmlParsingMode.Auto, HtmlParsingOptions.IgnoreComments);
HtmlParsingOptions.IgnoreComments was what I'm looking for.
Upvotes: 2