Let\'s say I have an HTML file with a lot of different elements, each having different attributes. Let\'s say I do not know beforehand how this HTML will look like.
Usin
You can pass an asterisk * with getElementsByTagName() which returns all elements:
*
foreach($dom->getElementsByTagName('*') as $element ){ }
From the Manual:
name The local name (without namespace) of the tag to match on. The special value * matches all tags.