[FLOW3-general] .xml output

mario chiari m at mariochiari.net
Fri Oct 5 11:04:05 CEST 2012


Christian, All


SOLVED!
It was easy, but it seems I need a line more than you suggest.
Now my xmlAction controller is:

public function xmlAction(\Mario\Crono\Domain\Model\Crono $crono) {
           $this->response->headers->set('Content-Type:', 'application/xml; '.' charset=UTF-8');  <<<<< needed!
	   $eventos = $this->eventoRepository->findByCrono($crono);
           $this->view->assign('eventos', $eventos);
           $this->view->assign('crono', $crono);
	}

I also add
protected $supportedMediaTypes = array('text/xml', 'application/xml', 'text/html', 'application/xhtml+xml');

thanks
cheers
mario



On Fri, 2012-09-28 at 16:46 +0200, mario chiari wrote:
> Hi Christian, 
> 
> thanks for the reply.
> I had already done as you suggest, but it does not work, in the
> following sense:
> 
> I have defined an xmlAction controller, and both xml.xml and xml.html
> fluid templates (and layouts too). Client side I get the .xml code I
> wish, but still Firefox read it as it were a .html source and does not
> show anything.
> 
> I checked the response headers:
> ---------------
> Date: Fri, 28 Sep 2012 14:23:41 GMT
> Server: Apache/2.2.17 (Fedora)
> X-Powered-By: PHP/5.3.8
> Expires: Thu, 19 Nov 1981 08:52:00 GMT
> Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
> pre-check=0
> Pragma: no-cache
> Set-Cookie: FLOW3=00cnhrg94sbe709u75c8227b04; path=/; HttpOnly
> X-FLOW3-Powered: FLOW3/1.1
> Content-Length: 474
> Connection: close
> Content-Type: text/html; charset=UTF-8
> 
> 200 OK
> ----------------------
> 
> Should Content-Type: be text/xml? How do I force to be so?
> I tried to add 
> protected $supportedMediaTypes = array('text/xml', 'text/html');
> but it does not seem to fix the output. 
> 
> I appreciate your help
>  
> mario
> 
> 
> 
> 
> On Fri, 2012-09-28 at 13:17 +0200, "Christian Müller (FLOW3 Team)"
> wrote:
> > Actually what should work:
> > 
> > Lets say you have some listAction that renders the data you need in HTML 
> > you also have a ListAction.html Fluid template for that action, now in 
> > the same directory you define a ListAction.xml Fluid template (rendering 
> > the xml as you want it) and call the same listAction with an .xml 
> > ending. Should give you back the xml.
> > 
> > Cheers,
> > Christian
> 
> 
> 
> _______________________________________________
> FLOW3-general mailing list
> FLOW3-general at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general




More information about the FLOW3-general mailing list