有人可以幫助我得到以下XML的第二個孩子:如何獲取XML二孩
<?xml version="1.0" encoding="UTF-8"?>
<GetItemResponse xmlns="urn:ebay:apis:eBLBaseComponents">
<Timestamp>2013-03-27T03:39:01.575Z</Timestamp>
<Ack>Success</Ack>
<Version>815</Version>
<Build>E815_CORE_API_15855340_R1</Build>
<item>
<ApplicationData>881030.B.0000</ApplicationData>
<AutoPay>false</AutoPay>
<BuyerProtection>ItemEligible</BuyerProtection>
<BuyItNowPrice currencyID="USD">0.0</BuyItNowPrice>
<Country>US</Country>
<Currency>USD</Currency>
<GiftIcon>0</GiftIcon>
<HitCounter>RetroStyle</HitCounter>
<ItemID></ItemID>
<ListingDetails>
<Adult>false</Adult>
<BindingAuction>false</BindingAuction>
<CheckoutEnabled>true</CheckoutEnabled>
<ConvertedBuyItNowPrice currencyID="USD">0.0</ConvertedBuyItNowPrice>
<ShippingServiceOptions>
<ShippingService>UPSGround</ShippingService>
<ShippingServiceCost currencyID="USD">9.99</ShippingServiceCost>
</ShippingServiceOptions>
<InternationalShippingServiceOption>
<ShippingService>StandardInternational</ShippingService>
<ShippingServiceCost currencyID="USD">39.99</ShippingServiceCost>
</InternationalShippingServiceOption>
<item>
我使用了一下,以循環通過所有的項目中(爲$項目爲$項目)。我需要從ShippingServiceOptions和InternationalShippingServiceOption中獲取ShippingServiceCost。
我要做到以下幾點,但它不工作:
//for ShippingServiceOptions
$item->getElementsByTagName('ShippingServiceCost')->item(0)->nodeValue;
//for InternationalServiceOptions
$item->getElementsByTagName('ShippingServiceCost')->item(1)->nodeValue;
我認爲這個問題是你不封閉'item'我不得不標籤 – luchosrock 2013-03-27 05:03:03