Hi,
I've just started using the parser and I need to parse an HTML page and get 'tr' tags with class 'even' that don't have an 'id' attribute. I tried a couple of approaches like:
$html->find('tr.even[!id]');
or
$html->find('tr[!id].even');
but none seems to work.
Is it possible to search for multiple attributes?
thanks,
Alon.
I would select all tr.even then in the foreach, bypass those that do have the "id" attribute
$ret = $html->find('div[id]'); foreach($html->find('tr[class=even]') as $e) if(!$e->id){ // process the data... } }
Last edit: pixeline 2013-12-08
Remember that find returns an array of dom objects (this is implicit in the answer pixeline gave).
Closing because this works in the latest version.
You can do it exactly in the way you wanted to do it initially
$html->find('tr.even[!id]');
or use the alternative version
$html->find('tr[class*="even"][!id]');
Here is my test script for reference.