|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-02-07 05:45 UTC] 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) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 04:00:01 2025 UTC |
<?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>"; } } ?>