I'm getting the following response back from the Amazon MWS API:
<?xml version="1.0"?>
<GetMatchingProductForIdResponse xmlns="http://ift.tt/1iBZrs1">
<GetMatchingProductForIdResult Id="B00002N97S" IdType="ASIN" status="Success">
<Products xmlns="http://ift.tt/1iBZrs1" xmlns:ns2="http://ift.tt/1iBZq7r">
<Product>
<Identifiers>
<MarketplaceASIN>
<MarketplaceId>ATVPDKIKX0DER</MarketplaceId>
<ASIN>B00002N97S</ASIN>
</MarketplaceASIN>
</Identifiers>
<AttributeSets>
<ns2:ItemAttributes xml:lang="en-US">
<ns2:Binding>Tools & Home Improvement</ns2:Binding>
<ns2:Brand>Moen</ns2:Brand>
<ns2:Color>White</ns2:Color>
<ns2:Department>Fixtures</ns2:Department>
<ns2:Feature>Fits all Moen 2 handle faucets except Roman tubs</ns2:Feature>
<ns2:Feature>Solid brass construction</ns2:Feature>
<ns2:Feature>Package contains only 1 cartridge</ns2:Feature>
<ns2:Feature>Replaces both hot and cold cartridges</ns2:Feature>
<ns2:Feature>Also used in 2 and 3 handle tub showers</ns2:Feature>
<ns2:Feature>Installation instructions included</ns2:Feature>
<ns2:ItemDimensions>
<ns2:Height Units="inches">6.50</ns2:Height>
<ns2:Length Units="inches">1.30</ns2:Length>
<ns2:Width Units="inches">2.10</ns2:Width>
</ns2:ItemDimensions>
<ns2:Label>MOEN</ns2:Label>
<ns2:ListPrice>
<ns2:Amount>13.85</ns2:Amount>
<ns2:CurrencyCode>USD</ns2:CurrencyCode>
</ns2:ListPrice>
<ns2:Manufacturer>MOEN</ns2:Manufacturer>
<ns2:MaterialType>Brass</ns2:MaterialType>
<ns2:Model>1224</ns2:Model>
<ns2:NumberOfItems>1</ns2:NumberOfItems>
<ns2:PackageDimensions>
<ns2:Height Units="inches">1.30</ns2:Height>
<ns2:Length Units="inches">6.50</ns2:Length>
<ns2:Width Units="inches">2.30</ns2:Width>
<ns2:Weight Units="pounds">0.05</ns2:Weight>
</ns2:PackageDimensions>
<ns2:PackageQuantity>1</ns2:PackageQuantity>
<ns2:PartNumber>1224</ns2:PartNumber>
<ns2:ProductGroup>Home Improvement</ns2:ProductGroup>
<ns2:ProductTypeName>PLUMBING_FIXTURE</ns2:ProductTypeName>
<ns2:Publisher>MOEN</ns2:Publisher>
<ns2:SmallImage>
<ns2:URL>http://ift.tt/1M33Zmz;
<ns2:Height Units="pixels">75</ns2:Height>
<ns2:Width Units="pixels">75</ns2:Width>
</ns2:SmallImage>
<ns2:Studio>MOEN</ns2:Studio>
<ns2:Title>MOEN 1224 Replacement Faucet Cartridge Kit Fits Most Double Handle Moen Faucets and Tub/Showers</ns2:Title>
</ns2:ItemAttributes>
</AttributeSets>
<Relationships>
<VariationParent>
<Identifiers>
<MarketplaceASIN>
<MarketplaceId>ATVPDKIKX0DER</MarketplaceId>
<ASIN>B00B4LDOIY</ASIN>
</MarketplaceASIN>
</Identifiers>
</VariationParent>
</Relationships>
<SalesRankings>
<SalesRank>
<ProductCategoryId>home_improvement_display_on_website</ProductCategoryId>
<Rank>1055</Rank>
</SalesRank>
<SalesRank>
<ProductCategoryId>542644011</ProductCategoryId>
<Rank>4</Rank>
</SalesRank>
</SalesRankings>
</Product>
</Products>
</GetMatchingProductForIdResult>
<ResponseMetadata>
<RequestId>02xnfr50-fdfa-5dg4-9ffc-xb6bx651fcb</RequestId>
</ResponseMetadata>
</GetMatchingProductForIdResponse>
Whenever I process this using:
$xml = simplexml_load_string($xml_string, 'SimpleXMLElement', LIBXML_NOCDATA);
...I find that the entire AttributeSets
tree is empty in the $xml
variable.
How do I load the string and get all the namespaces in one result?
PHP 5.6.
No comments:
Post a Comment