DOMDocument/DOMElement problem

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

 



I'm currently trying to parse a document with DOMDocument, and I'm
having some serious problems. I created a script that runs fine on php
5.2.9, ripping out content using DOMNode::nodeValue. The same script
fails to get any content on php 5.3.3 - even though it correctly
navigates to the proper nodes to extract content.

Basically, the code used looks like this:

$dom = new DOMDocument();
$dom->loadHTML($data);
$dom->preserveWhiteSpace = false;
$xpath = new DOMXpath($dom);
$nodelist = $xpath->query($query);
$value = $nodelist->item(0)->nodeValue;

I've checked to make sure that item(0) is in fact a node - it's there
and even of the right type (a td - table cell), but nodeValue is
empty.

The script works on some documents but not others (on 5.3.3 - some
checking suggests a doctype of xhtml might be involved in the problem
but I tried ripping the doctype out and had no difference) - on 5.2.9
it works on all documents, returning the proper nodeValue.

Am I missing something basic?

TIA
Peter

-- 
<hype>
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
</hype>

-- 
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