HTML Agility Pack Parsing With Upper & Lower Case Tags?

前端 未结 1 633
陌清茗
陌清茗 2020-12-11 08:13

I am using the HTML Agility Pack to great effect, and am really impressed with it - However, I am selecting content like so

doc.DocumentNode.SelectSingleNode         


        
1条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-11 08:46

    The Html Agility Pack handles HTML in a case insensitive way. It means it will parse BODY, Body and body the same way. It's by design since HTML is not case sensitive (XHTML is).

    That said, when you use its XPATH feature, you must use tags written in lower case. It means the "//body" expression will match BODY, Body and body, and "//BODY" will match nothing.

    0 讨论(0)
提交回复
热议问题