Call to a member function children() on a non-object

Deseeague

New Member
I am getting this error when I try to extract information from an XML file. The code to get the information is:\[code\]//retrieve amazon data$parsed_xml = amazon_xml($isbn);$amazonResult = array(); //print_r($parsed_xml); die;$current = $parsed_xml->ListMatchingProductsResponse->ListMatchingProductsResult->Products->Product; //if($parsed_xml) { $amazonResult = array( 'Title' => $current->AttributeSets->children('ns2')->ItemAttributes->Title, 'SalesRank' => $current->SalesRankings->SalesRank->Rank, 'ListPrice' => $current->AttributeSets->ItemAttributes->ListPrice->Amount, 'ImageURL' => $current->AttributeSets->ItemAttributes->SmallImage->URL, 'DetailURL' => $current->AttributeSets->ItemAttributes->SmallImage->URL,\[/code\]and the XML file is:\[code\]<?xml version="1.0"?><ListMatchingProductsResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01"><ListMatchingProductsResult><Products xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01" xmlns:ns2="http://mws.amazonservices.com/schema/Products/2011-10-01/default.xsd"><Product><AttributeSets><ns2:ItemAttributes xml:lang="en-US"><ns2:Title>JavaScript: The Missing Manual</ns2:Title>\[/code\]When i run this I get a null value, and when I check the error log I get:Call to a member function children() on a non-object in ... on line 52.The offending line is:\[code\]'Title' => $current->AttributeSets->children('ns2')->ItemAttributes->Title,\[/code\]The only items that have the namespace of ns2 are ItemAttributes and Title.How do I correct this so I can get the title information?Thanks
 
Back
Top