framework/web/XmlResponseFormatter.php
public function format($response)
    {
        $charset = $this->encoding === null ? $response->charset : $this->encoding;
        if (stripos($this->contentType, 'charset') === false) {
            $this->contentType .= '; charset=' . $charset;
        }
        $response->getHeaders()->set('Content-Type', $this->contentType);
        if ($response->data !== null) {
            $dom = new DOMDocument($this->version, $charset);
            if (!empty($this->rootTag)) {
                $root = new DOMElement($this->rootTag);
                $dom->appendChild($root);
                $this->buildXml($root, $response->data);
            } else {
                $this->buildXml($dom, $response->data);
            }
            $response->content = $dom->saveXML();
        }
    }
public function format($response)
    {
        $charset = $this->encoding === null ? $response->charset : $this->encoding;
        if (stripos($this->contentType, 'charset') === false) {
            $this->contentType .= '; charset=' . $charset;
        }
        $response->getHeaders()->set('Content-Type', $this->contentType);
        if ($response->data !== null) {
            $dom = new DOMDocument($this->version, $charset);
            if (!empty($this->rootTag)) {
                $root = new DOMElement($this->rootTag);
                $dom->appendChild($root);
                $this->buildXml($root, $response->data);
            } else {
                $this->buildXml($dom, $response->data);
            }
            $response->content = $dom->saveXML();
        }
    }
public function format ( $ response ) { $ charset = $ this -> encoding === null ? $ response -> charset : $ this -> encoding ; if ( stripos ( $ this -> contentType , 'charset' ) === false ) { $ this -> contentType .= '; charset=' . $ charset ; } $ response -> getHeaders ( ) -> set ( 'Content-Type' , $ this -> contentType ) ; if ( $ response -> data !== null ) { $ dom = new DOMDocument ( $ this -> version , $ charset ) ; if ( ! empty ( $ this -> rootTag ) ) { $ root = new DOMElement ( $ this -> rootTag ) ; $ dom -> appendChild ( $ root ) ; $ this -> buildXml ( $ root , $ response -> data ) ; } else { $ this -> buildXml ( $ dom , $ response -> data ) ; } $ response -> content = $ dom -> saveXML ( ) ; } }
Formats the specified response.
@param Response $response the response to be formatted.
Formats the specified response .