Agility Parsing HTML package with top and bottom tags?

I use the HTML Agility Pack for a great effect and I am really impressed with it. However, I select content this way

doc.DocumentNode.SelectSingleNode("//body").InnerHtml 

How can I solve the following situation with different documents?

 <body> <Body> <BODY> 

Will my code above only get lowercase versions?

+4
source share
1 answer

The HTML Agility Pack handles HTML in a case-insensitive manner. This means that he will analyze the body, body and body in the same way. This is by design since HTML is not case sensitive (there is XHTML).

However, when you use your XPATH function, you must use lowercase tags. This means that the expression "//body" will match BODY, Body and body, and "// BODY" will not match anything.

+16
source

All Articles