Re: DOM - parse HTML document [solved]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 12:07 AM +0200 9/13/06, Leonidas Safran wrote:
Hello all,

I have found a way...

$doc = new DomDocument();
$doc->loadHTMLFile($source["url"]);

$elements = $doc->getElementsByTagName("tr");

$i = 0;

while( $elements->item($i) ){
if( $elements->item($i)->hasAttributes() && preg_match("/td[0|1]/",$elements->item($i)->getAttribute("id")) > 0 ){
  echo $elements->item($i)->nodeValue . "<br />";
  }
  $i++;
}

Works like i want...


Regards,

LS


Interesting -- it doesn't work for me. I keep getting --

Parse error: parse error, unexpected T_OBJECT_OPERATOR

-- in your if statement. But, I don't see the problem.

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux