loadHTML()

From: Date: Tue, 25 Dec 2007 02:03:04 +0000
Subject: loadHTML()
Groups: php.general 
Request: Send a blank email to php-general+get-266261@lists.php.net to get a copy of this message
Just getting into DOMDocument()... I'm loading an HTML page and trying to extract certain bits of text. Just one problem: loadHTML() seems to ignore orphan tags like '<br>'. For example, in the following HTML: <div class="text">Some text is here. <br> New line. <br> Another new line. </div> <div class="text">Some text is here. <br> New line. <br> Another new line. </div> <div class="text">Some text is here. <br> New line. <br> Another new line. </div> If I run the above HTML through: $nodes = $table->getElementsByTagName("*"); I only get three nodes that I can iterate through (<div>). What I want to do is split/explode the three lines within each div, but when I look at the nodeValue of each node, it only shows something like "Some text is here. New line. Another new line." Any ideas? ...Rene

« previous php.general (#266261) next »