src/NotAllowedHandler.php
protected function renderXML(
        ServerRequestInterface $request,
        ResponseInterface $response,
        array $allowedMethods
    ) {
        $message = sprintf('Method %s is not allowed', $request->getMethod());
        $baseSep = str_repeat(' ', 4);
        $sep = str_repeat($baseSep, 2);
        $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
            . "<root>\n"
            . "{$baseSep}<error>\n"
            . "{$sep}<message>{$message}</message>\n";

        if ($this->isDisplayError()) {
            $method = htmlentities($request->getMethod());
            $allowedMethodXML = '';
            foreach ($allowedMethods as $value) {
                $value = htmlentities($value);
                $allowedMethodXML .= "{$baseSep}<method>{$value}</method>\n{$sep}";
            }

            $xml .= "{$sep}<request_method>{$method}</request_method>\n";
            $xml .= "{$sep}<allowed_methods>\n{$sep}{$allowedMethodXML}</allowed_methods>\n";
        }

        $xml .= "{$baseSep}</error>\n</root>";
        echo $xml;
    }
protected function renderXML(
        ServerRequestInterface $request,
        ResponseInterface $response,
        array $allowedMethods
    ) {
        $message = sprintf('Method %s is not allowed', $request->getMethod());
        $baseSep = str_repeat(' ', 4);
        $sep = str_repeat($baseSep, 2);
        $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
            . "<root>\n"
            . "{$baseSep}<error>\n"
            . "{$sep}<message>{$message}</message>\n";

        if ($this->isDisplayError()) {
            $method = htmlentities($request->getMethod());
            $allowedMethodXML = '';
            foreach ($allowedMethods as $value) {
                $value = htmlentities($value);
                $allowedMethodXML .= "{$baseSep}<method>{$value}</method>\n{$sep}";
            }

            $xml .= "{$sep}<request_method>{$method}</request_method>\n";
            $xml .= "{$sep}<allowed_methods>\n{$sep}{$allowedMethodXML}</allowed_methods>\n";
        }

        $xml .= "{$baseSep}</error>\n</root>";
        echo $xml;
    }
protected function renderXML ( ServerRequestInterface $ request , ResponseInterface $ response , array $ allowedMethods ) { $ message = sprintf ( 'Method %s is not allowed' , $ request -> getMethod ( ) ) ; $ baseSep = str_repeat ( ' ' , 4 ) ; $ sep = str_repeat ( $ baseSep , 2 ) ; $ xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" . "<root>\n" . "{$baseSep}<error>\n" . "{$sep}<message>{$message}</message>\n" ; if ( $ this -> isDisplayError ( ) ) { $ method = htmlentities ( $ request -> getMethod ( ) ) ; $ allowedMethodXML = '' ; foreach ( $ allowedMethods as $ value ) { $ value = htmlentities ( $ value ) ; $ allowedMethodXML .= "{$baseSep}<method>{$value}</method>\n{$sep}" ; } $ xml .= "{$sep}<request_method>{$method}</request_method>\n" ; $ xml .= "{$sep}<allowed_methods>\n{$sep}{$allowedMethodXML}</allowed_methods>\n" ; } $ xml .= "{$baseSep}</error>\n</root>" ; echo $ xml ; }
Render XML Output

@param ServerRequestInterface $request
@param ResponseInterface      $response just for reference
@param array $allowedMethods

@return void
Render XML Output