Jump to content

problem with parsing xml


hungryfrank

Recommended Posts

i am having a problem parsing the file that ebay returns for error codes


  $results = new SimpleXMLElement($responseXml);
 if ( $results->Errors != null )

		foreach ($results->Errors as $key => $value) {
            
                $longMsg =$results->Errors->LongMessage;
		$shortMsg = $results->Errors->ShortMessage;
		$code = $results->Errors->ErrorCode;
		echo '<P>' . $code . ' : ' . str_replace( ">", ">", str_replace( "<", "<", $shortMsg ) );
			if ( $longMsg != '' )
				echo '<BR>' . str_replace( ">", ">", str_replace( "<", "<", $longMsg ) );

								}
				
	echo "<br>";
}

but i get the same entery repeated again. 

here is  XML file

SimpleXMLElement Object
(
    [Timestamp] => 2017-08-03T19:38:29.478Z
    [Ack] => Warning
    [Errors] => Array
        (
            [0] => SimpleXMLElement Object
                (
                    [ShortMessage] => Unrecognized element <ActiveList.EntriesPerPage> in request message.
                    [LongMessage] => The element <ActiveList.EntriesPerPage> was found in the input request message.  This is not a declared element in the schema and will be ignored.
                    [ErrorCode] => 21927
                    [SeverityCode] => Warning
                    [ErrorParameters] => SimpleXMLElement Object
                        (
                            [@attributes] => Array
                                (
                                    [ParamID] => 0
                                )

                            [Value] => ActiveList.EntriesPerPage
                        )

                    [ErrorClassification] => RequestError
                )

            [1] => SimpleXMLElement Object
                (
                    [ShortMessage] => Unrecognized element <ActiveList.PageNumber> in request message.
                    [LongMessage] => The element <ActiveList.PageNumber> was found in the input request message.  This is not a declared element in the schema and will be ignored.
                    [ErrorCode] => 21927
                    [SeverityCode] => Warning
                    [ErrorParameters] => SimpleXMLElement Object
                        (
                            [@attributes] => Array
                                (
                                    [ParamID] => 0
                                )

                            [Value] => ActiveList.PageNumber
                        )

                    [ErrorClassification] => RequestError
                )

        )
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.