php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28916 Reference result of XPath becomes empty.
Submitted: 2004-06-25 11:28 UTC Modified: 2004-06-28 07:33 UTC
From: s dot masugata at digicom dot dnp dot co dot jp Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 4.3.7 OS: RedHat9 Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
39 + 37 = ?
Subscribe to this entry?

 
 [2004-06-25 11:28 UTC] s dot masugata at digicom dot dnp dot co dot jp
Description:
------------
Reference result becomes empty when an XML file is searched.

<?xml version="1.0" ?>
<country>
  <list no="1">
    <name>Japan</name>
    <language>Japanese</language>
    <area>Asia</area>
  </list>
</country>

Reference result becomes empty when an XML file is searched.
However, reference result comes by PHP4.3.3 on the contrary.

PHP-4.3.3[cli]
PHP-4.3.7[cli]
libxml2-2.6.10


Reproduce code:
---------------
<?
$XML = domxml_open_file( "country.xml" );

foreach( $XML->get_elements_by_tagname( "/country/list[@no=1]" ) as $Array )
{
  foreach( $Array->child_nodes( ) as $Child_Array )
  {
    $TagName         = $Child_Array->node_name( );
    $Value[$TagName] = de_convert( $Child_Array->get_content( ) );
 }

 echo "------------------------\n".
      "Country :".$Value["name"]."\n".
      "Area    ?F".$Value["area"]."\n".
      "Language?F".$Value["language"]."\n\n";
}
?>


Expected result:
----------------
------------------------
Country :Japan
Area    :Asia
Language:Japanese

Actual result:
--------------
empty.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-28 07:33 UTC] chregu@php.net
get_elements_by_tagname can't be used for xpath searches anymore. This was a bug in 4.3.3. Please use the appropriate XPath functions, for example xpath_eval (http://www.php.net/manual/en/function.xpath-eval.php)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 15:01:56 2024 UTC