有人可以帮我获得以下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>
我正在使用 for 循环浏览所有项目(对于 $items 作为 $item)。我需要从 ShippingServiceOptions 和 InternationalShippingServiceOption 获取 ShippingServiceCost。
我想执行以下操作,但它不起作用:
//for ShippingServiceOptions
$item->getElementsByTagName('ShippingServiceCost')->item(0)->nodeValue;
//for InternationalServiceOptions
$item->getElementsByTagName('ShippingServiceCost')->item(1)->nodeValue;