[xwiki-users] how to generate XML from a velocity script page ?

Sergiu Dumitriu sergiu at xwiki.com
Thu Jun 7 13:43:09 UTC 2012


On 06/07/2012 09:28 AM, mathieu.canzerini at intech.lu wrote:
> Hello everybody,
>
> i need to use Ajax but i can not generate XML from a velocity script page.
> Here is a piece of my script :
> {{velocity}}
> $response.setContentType('application/xml')
> #set ($out = $response.getOutputStream())
> $out.write("<?xml version='1.0' encoding='ISO-8859-1'?><test>test</test>")
> ...
> {{/velocity}}
>
> But my responseXML is null.
>
> I suppose that it's not the good way to generate XML from velocity.
>
> Thanks for your help.
>
> M. Canzerini

See this other thread:
http://markmail.org/message/tjrnj6zy2n37blua

Short summary, you should call flush() and close() on the stream after 
you're done writing data to it.


-- 
Sergiu Dumitriu
http://purl.org/net/sergiu/


More information about the users mailing list