/**
  * Parses the SOAP response of the API and returns a new Result object.
  *
  * @param string $response SOAP response of the API
  * @return Result
  */
 protected function parseResponse($response)
 {
     $xml = new SimpleXMLElement($response);
     $ns = $xml->getNamespaces(true);
     $data = $xml->children($ns['env'])->children($ns['m'])->markupvalidationresponse;
     $result = new Result();
     $result->setIsValid($data->validity == 'true');
     foreach ($data->errors->errorlist->error as $error) {
         $entry = $this->getEntry($error);
         $result->addError($entry);
     }
     foreach ($data->warnings->warninglist->warning as $warning) {
         if (strpos($warning->messageid, 'W') === false) {
             $entry = $this->getEntry($warning);
             $result->addWarning($entry);
         }
     }
     return $result;
 }