ID:               50951
 Updated by:       j...@php.net
-Summary:          SimpleXml xpath doesn't return a ligitimate xpath
                   query
 Reported By:      arashaga at gmail dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         Scripting Engine problem
 Operating System: xp
 PHP Version:      5.3.1
 New Comment:

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/




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

[2010-02-08 22:35:12] arashaga at gmail dot com

Actually instead of that whole "for and foreach" block we can use 
var_dump($rest);

and it will return bool(false).

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

[2010-02-08 21:59:54] arashaga at gmail dot com

<?php

/*please use the xml feed that I have provided as an example instead 
of the ebay.xml*/
$xml = simplexml_load_file('ebay.xml');

 $xml-
>registerXpathNamespace('ebay','urn:ebay:apis:eBLBaseComponents');

 $resp = $xml-
>xpath("//ebay:CurrentPrice[.=1.98]/parent::Item/Storefront/StoreName"
);
 
for($i=0;$i < count($resp)/2; $i++ )
{
        
foreach($resp[$i] as  $key => $value)
{
        //echo "['".$key."']=".$value."<br>";
        echo "[$key]= $value<br>";
        
}
}
?>

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

[2010-02-07 09:37:51] j...@php.net

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.



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

[2010-02-07 05:45:01] arashaga at gmail dot com

Description:
------------
in the example below I get the xpath query result in Xpath qury tools
like Xpath spy but when it's run in PHP I don't get anything.




it shoud output the storename but it doesn't.

Reproduce code:
---------------
//xml file (partially)
<Item>
<ItemID>341396747871</ItemID>
−
<ViewItemURLForNaturalSearch>
http://product.half.ebay.com/GMAT-Quantitative-Review-Paperback-2005_W0QQprZ48636818QQtgZvidetailsQQitemZ341396747871
</ViewItemURLForNaturalSearch>
<Quantity>1</Quantity>
−
<Seller>
<FeedbackScore>32</FeedbackScore>
<PositiveFeedbackPercent>100.0</PositiveFeedbackPercent>
</Seller>
<CurrentPrice currencyID="USD">1.98</CurrentPrice>
−
<Storefront>
−
<StoreURL>
http://shops.half.ebay.com/rogerlee14_W0QQsellerZrogerlee14
</StoreURL>
<StoreName>rogerlee14</StoreName>
</Storefront>
<Country>US</Country>
<HalfItemCondition>BrandNew</HalfItemCondition>
−
<SellerComments>
Brand new, never used.  No markings at all.  Ships fast!
</SellerComments>
</Item>

the query is

//CurrentPrice[.=1.98]/parent::Item/Storefront/StoreName

Expected result:
----------------
rogerlee14

Actual result:
--------------
boolean(false)


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


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

Reply via email to