I have an HTML document which has different tables in it.
Simple examples include 2 types:
<table>
<table class="footer" id="some-x">
To select all nodes where the table has an attribute called id
I can use
DocumentNode.SelectNodes("//table[@id]")
What I'm tying to figure out of the opposite, how do I select nodes where the tables do NOT have any attribute called id
(or any class, i.e just bare tags) (example 1)
You can use not()
to select tables that don't have any id
attribute :
DocumentNode.SelectNodes("//table[not(@id)]")
...or to select tables without any attribute at all :
DocumentNode.SelectNodes("//table[not(@*)]")