ID:               40500
 User updated by:  schalk at unf dot edu
 Reported By:      schalk at unf dot edu
 Status:           Assigned
 Bug Type:         DOM XML related
 Operating System: Mac OSX 10.4.8
 PHP Version:      5.2.1
 Assigned To:      rrichards
 New Comment:

Ignore this....
I did not set $xml->preserveWhiteSpace=false;

You can close this, sorry!


Previous Comments:
------------------------------------------------------------------------

[2007-02-15 19:41:00] [EMAIL PROTECTED]

For some reason I think it has nothing to do with PHP.
Rob, am I right?

------------------------------------------------------------------------

[2007-02-15 19:23:17] schalk at unf dot edu

Description:
------------
When I use previousSibling to get values of elements at the same level
in the tree it does not work as expected.  Seems to need 2x the
previousSibling calls to get to the right node. Seems to be adding in
extra return characters (see actual result).

Note:
   echo "Found
".$entry->previousSibling->previousSibling->previousSibling->previousSibling->nodeValue."
by ".$entry->previousSibling->previousSibling->nodeValue."<br>\n";

produces the correct result!

Reproduce code:
---------------
<?php
$xml= new DOMDocument();
$xml->load('http://fad.coas.unf.edu/animl/jcamp/xpathtest.xml');

$xpath = new DOMXPath($xml);
$entries =
$xpath->query('/book/chapter/para/informaltable/tgroup/tbody/row/entry[.
= "en"]');

foreach ($entries as $entry)
{
   echo "Found ".$entry->previousSibling->previousSibling->nodeValue."
by ".$entry->previousSibling->nodeValue."<br>\n";
}

Expected result:
----------------
Found The Grapes of Wrath by John Steinbeck<br>
Found The Pearl by John Steinbeck<br>

(returned web page source code)

Actual result:
--------------
Found John Steinbeck by 
       <br>
Found John Steinbeck by 
       <br>

(returned web page source code)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=40500&edit=1

Reply via email to