Parse HTML And Traverse DOM In PHP?

I spoke of this the other day, but now I’ve learned of PHP’s DOM functions, including loadHTML(). Use it in combination with simplexml_import_dom like this:

``` $dom = new domDocument; $dom->loadHTML('
  • one
  • two
  • three
    • sublist item
'

); if($dom){ $xml = simplexml_import_dom($dom); print_r($xml); }

e>
  </td>
</tr>