获取xml的状态

I am working with the amazon API and I need to check the status of the XML. For example:

<GetMatchingProductForIdResult status="Success" IdType="UPC" Id="082686068055">

or

<GetMatchingProductForIdResult status="ClientError" IdType="UPC" Id="082686068055">

How would I go about writing a code that checks if the status is not "Success"? The XML looks like this:

<GetMatchingProductForIdResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">
  <GetMatchingProductForIdResult status="Success" IdType="UPC" Id="082686068055">
    <Products>
      <Product>
        <Identifiers>
          ... 
        </Identifiers>
        <AttributeSets>
        </AttributeSets>
      </Product>
    </Products>
  </GetMatchingProductForIdResult>

Error:

<GetMatchingProductForIdResult Id="082686035408" IdType="UPC" status="ClientError">
  <Error>
    <Type>Sender</Type>
      <Code>InvalidParameterValue</Code>
      <Message>Invalid UPC identifier 082686035408 for marketplace ATVPDKIKX0DER</Message>
  </Error>
</GetMatchingProductForIdResult>

PHP Code to retrieve the content:

if(isset($items->Products->Product->AttributeSets->children($namespace['ns2'])->ItemAttributes->ListPrice->Amount)) { 
    $amount = $items->Products->Product->AttributeSets->children($namespace['ns2'])->ItemAttributes->ListPrice->Amount;
}else{
    $amount = '0.00';
}

I was able to create this code to get the ID of the product:

//$xml is an open XML file.
$items=$xml->GetMatchingProductForIdResult; 
if(isset($items['Id'])){ 
    $id = $items['Id']; 
}else{
    $id = 'No Id Found';
}

The first tag stays throughout the whole XML file. The tag closes at the end of the file. I am using SimpleXML to open, and get all of the other data needed from the file, but I always have an error when the tags in <AttributeSets> is not valid. I need to find a way to avoid this problem. Thanks in advance.

In fact, there is many ways to go. But as you want just detect whether a error or success occurr:

<?php 

$xmldata = <<<XML
<?xml version='1.0' ?>
<GetMatchingProductForIdResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">
    <GetMatchingProductForIdResult status="Success" IdType="UPC" Id="082686068055">
        ....
    </GetMatchingProductForIdResult>
</GetMatchingProductForIdResponse>
XML;

$xml = new SimpleXmlElement($xmldata);
$items = $xml->GetMatchingProductForIdResult;
$ERROR_FOUND = 'Error' == $items->attributes()->status;

if ($ERROR_FOUND) {
    // do something on error, such as return or exit()...
} 
// continue xml data parsing