protected function parseSOAP12Response($xml)
    {
        $doc = new \DOMDocument('1.0', 'UTF-8');

        if ($doc->loadXML($xml) === false) {
            throw new Exception('Failed load xml');
        }

        $response = new Response();

        // Get the standard CDATA elements
        foreach (array('uri', 'checkedby', 'doctype', 'charset') as $var) {
            $element = $doc->getElementsByTagName($var);
            if ($element->length) {
                $response->{'set' . ucfirst($var)}($element->item(0)->nodeValue);
            }
        }

        // Handle the bool element validity
        $element = $doc->getElementsByTagName('validity');
        if ($element->length && $element->item(0)->nodeValue === 'true') {
            $response->setValidity(true);
        } else {
            $response->setValidity(false);
        }

        if (!$response->isValidity()) {
            $errors = $doc->getElementsByTagName('error');
            foreach ($errors as $error) {
                $response->addError(new Error($error));
            }
        }
        $warnings = $doc->getElementsByTagName('warning');
        foreach ($warnings as $warning) {
            $response->addWarning(new Warning($warning));
        }

        return $response;
    }
protected function parseSOAP12Response($xml)
    {
        $doc = new \DOMDocument('1.0', 'UTF-8');

        if ($doc->loadXML($xml) === false) {
            throw new Exception('Failed load xml');
        }

        $response = new Response();

        // Get the standard CDATA elements
        foreach (array('uri', 'checkedby', 'doctype', 'charset') as $var) {
            $element = $doc->getElementsByTagName($var);
            if ($element->length) {
                $response->{'set' . ucfirst($var)}($element->item(0)->nodeValue);
            }
        }

        // Handle the bool element validity
        $element = $doc->getElementsByTagName('validity');
        if ($element->length && $element->item(0)->nodeValue === 'true') {
            $response->setValidity(true);
        } else {
            $response->setValidity(false);
        }

        if (!$response->isValidity()) {
            $errors = $doc->getElementsByTagName('error');
            foreach ($errors as $error) {
                $response->addError(new Error($error));
            }
        }
        $warnings = $doc->getElementsByTagName('warning');
        foreach ($warnings as $warning) {
            $response->addWarning(new Warning($warning));
        }

        return $response;
    }
protected function parseSOAP12Response ( $ xml ) { $ doc = new \ DOMDocument ( '1.0' , 'UTF-8' ) ; if ( $ doc -> loadXML ( $ xml ) === false ) { throw new Exception ( 'Failed load xml' ) ; } $ response = new Response ( ) ; // Get the standard CDATA elements foreach ( array ( 'uri' , 'checkedby' , 'doctype' , 'charset' ) as $ var ) { $ element = $ doc -> getElementsByTagName ( $ var ) ; if ( $ element -> length ) { $ response -> { 'set' . ucfirst ( $ var ) } ( $ element -> item ( 0 ) -> nodeValue ) ; } } // Handle the bool element validity $ element = $ doc -> getElementsByTagName ( 'validity' ) ; if ( $ element -> length && $ element -> item ( 0 ) -> nodeValue === 'true' ) { $ response -> setValidity ( true ) ; } else { $ response -> setValidity ( false ) ; } if ( ! $ response -> isValidity ( ) ) { $ errors = $ doc -> getElementsByTagName ( 'error' ) ; foreach ( $ errors as $ error ) { $ response -> addError ( new Error ( $ error ) ) ; } } $ warnings = $ doc -> getElementsByTagName ( 'warning' ) ; foreach ( $ warnings as $ warning ) { $ response -> addWarning ( new Warning ( $ warning ) ) ; } return $ response ; }
Parse an XML response from the validator

This function parses a SOAP 1.2 response xml string from the validator.

@param string $xml The raw soap12 XML response from the validator.

@return Response object HTMLValidator\Response

@throws Exception
Parse an XML response from the validator