Jump to content

problem with parsing xml


Go to solution Solved by Jacques1,

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
https://forums.phpfreaks.com/topic/304499-problem-with-parsing-xml/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.