private function parse($content)
    {

        if ($this->method == 'downloadFile') {
            return $this->parseResponseDownloadFile($content);
        }

        $xml = new SimpleXMLElement($content);
        if (isset($xml->error)) {
            throw new Exception\ZohoErrorException(
                new ZohoError(
                    (string) $xml->error->code,
                    (string) $xml->error->message
                )
            );
        }

        if (isset($xml->nodata)) {
            throw new Exception\NoDataException(
                new ZohoError(
                    (string)$xml->nodata->code, (string) $xml->nodata->message
                )
            );
        }

        if ($this->method == 'getFields') {
            return $this->parseResponseGetFields($xml);
        }

        if ($this->method == 'deleteRecords') {
            return $this->parseResponseDeleteRecords($xml);
        }

        if ($this->method == 'uploadFile') {
            return $this->parseResponseUploadFile($xml);
        }

        if ($this->method == 'deleteFile') {
            return $this->parseResponseDeleteFile($xml);
        }

        if ($this->method == 'getDeletedRecordIds') {
            return $this->parseResponseGetDeletedRecordIds($xml);
        }

        if ($this->method == 'convertLead') {
            return $this->parseResponseConvertLead($xml);
        }

        if ($this->method == 'updateRelatedRecords') {
            return $this->parseUpdateRelatedRecords($xml);
        }

        if (isset($xml->result->{$this->module})) {
            return $this->parseResponseGetRecords($xml);
        }

        if (isset($xml->result->row->success) || isset($xml->result->row->error)) {
            return $this->parseResponsePostRecordsMultiple($xml);
        }

        throw new Exception\UnexpectedValueException('Xml doesn\'t contain expected fields');
    }
private function parse($content)
    {

        if ($this->method == 'downloadFile') {
            return $this->parseResponseDownloadFile($content);
        }

        $xml = new SimpleXMLElement($content);
        if (isset($xml->error)) {
            throw new Exception\ZohoErrorException(
                new ZohoError(
                    (string) $xml->error->code,
                    (string) $xml->error->message
                )
            );
        }

        if (isset($xml->nodata)) {
            throw new Exception\NoDataException(
                new ZohoError(
                    (string)$xml->nodata->code, (string) $xml->nodata->message
                )
            );
        }

        if ($this->method == 'getFields') {
            return $this->parseResponseGetFields($xml);
        }

        if ($this->method == 'deleteRecords') {
            return $this->parseResponseDeleteRecords($xml);
        }

        if ($this->method == 'uploadFile') {
            return $this->parseResponseUploadFile($xml);
        }

        if ($this->method == 'deleteFile') {
            return $this->parseResponseDeleteFile($xml);
        }

        if ($this->method == 'getDeletedRecordIds') {
            return $this->parseResponseGetDeletedRecordIds($xml);
        }

        if ($this->method == 'convertLead') {
            return $this->parseResponseConvertLead($xml);
        }

        if ($this->method == 'updateRelatedRecords') {
            return $this->parseUpdateRelatedRecords($xml);
        }

        if (isset($xml->result->{$this->module})) {
            return $this->parseResponseGetRecords($xml);
        }

        if (isset($xml->result->row->success) || isset($xml->result->row->error)) {
            return $this->parseResponsePostRecordsMultiple($xml);
        }

        throw new Exception\UnexpectedValueException('Xml doesn\'t contain expected fields');
    }
private function parse ( $ content ) { if ( $ this -> method == 'downloadFile' ) { return $ this -> parseResponseDownloadFile ( $ content ) ; } $ xml = new SimpleXMLElement ( $ content ) ; if ( isset ( $ xml -> error ) ) { throw new Exception \ ZohoErrorException ( new ZohoError ( ( string ) $ xml -> error -> code , ( string ) $ xml -> error -> message ) ) ; } if ( isset ( $ xml -> nodata ) ) { throw new Exception \ NoDataException ( new ZohoError ( ( string ) $ xml -> nodata -> code , ( string ) $ xml -> nodata -> message ) ) ; } if ( $ this -> method == 'getFields' ) { return $ this -> parseResponseGetFields ( $ xml ) ; } if ( $ this -> method == 'deleteRecords' ) { return $ this -> parseResponseDeleteRecords ( $ xml ) ; } if ( $ this -> method == 'uploadFile' ) { return $ this -> parseResponseUploadFile ( $ xml ) ; } if ( $ this -> method == 'deleteFile' ) { return $ this -> parseResponseDeleteFile ( $ xml ) ; } if ( $ this -> method == 'getDeletedRecordIds' ) { return $ this -> parseResponseGetDeletedRecordIds ( $ xml ) ; } if ( $ this -> method == 'convertLead' ) { return $ this -> parseResponseConvertLead ( $ xml ) ; } if ( $ this -> method == 'updateRelatedRecords' ) { return $ this -> parseUpdateRelatedRecords ( $ xml ) ; } if ( isset ( $ xml -> result -> { $ this -> module } ) ) { return $ this -> parseResponseGetRecords ( $ xml ) ; } if ( isset ( $ xml -> result -> row -> success ) || isset ( $ xml -> result -> row -> error ) ) { return $ this -> parseResponsePostRecordsMultiple ( $ xml ) ; } throw new Exception \ UnexpectedValueException ( 'Xml doesn\'t contain expected fields' ) ; }
Parses the XML returned by Zoho to the appropriate objects

@param string $content Response body as returned by Zoho
@throws Exception\UnexpectedValueException When invalid XML is given to parse
@throws Exception\NoDataException when Zoho tells us there is no data
@throws Exception\ZohoErrorException when content is a Error response
@return bool|Response\Record|Response\Record[]|Response\Field[]|Response\MutationResult
Parses the XML returned by Zoho to the appropriate objects