[Grok-dev] XML output using a page template?
Jan-Wijbrand Kolman
janwijbrand at gmail.com
Wed Feb 16 03:44:12 EST 2011
On 2/16/11 8:40 AM, Sascha Boch wrote:
> Quick question - I'd like to use a page template to output XML data. How do I do this?
Add an xml declaration at the top of your pt..:
<?xml version="1.0" encoding="utf-8" ?>
..and off you go adding a root element and childs! Page templates are
XML themselves, basically, and are designed to render XML.
You might need to set the response content type header explicitly in you
view component, something like so..:
def update(self):
self.request.response.setHeader("Content-Type", "text/xml")
..where the actual content type might of course be even more specific
than that.
HTH
regards, jw
More information about the Grok-dev
mailing list