Micle
Micle

Reputation: 151

number of elements which have style attribute with HtmlAgilityPack

I'm using HtmlAgilityPack to parse HTML. I want to get the number of elements which have inline style.

Something like:

HtmlDocument.DocumentNode.SelectNodes("//*[has('@style')]").count

Upvotes: 0

Views: 454

Answers (1)

Xi Sigma
Xi Sigma

Reputation: 2372

You could use

doc.DocumentNode.SelectNodes("//*[@style]").Count

You do not need to specify a value for the given attribute.

Upvotes: 1

Related Questions