C # parse html using XPathDocument

I am trying to parse an html page with XPathDocument but it gives an error because html is not xml ... is there any way to do this or not?

+3
source share
2 answers

Must use HtmlAgilityPack . Better!

+6
source

Use something like the Html Agility Pack , which can load your html into a DOM object that can be accessed, for example, to xpath requests.

If your html is actually not xhtml, it is usually not a valid xml structure with the right opening and ending node tags.

+2
source

Source: https://habr.com/ru/post/1769698/


All Articles