You might also have to set the header content-Type to xml. no?
On 3/30/07, Elias <[EMAIL PROTECTED]> wrote:
>
>
> Thanks a lot that totally makes sense.
>
> On Mar 29, 2:41 pm, "Deron Meranda" <[EMAIL PROTECTED]> wrote:
> > On 3/29/07, Elias <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > Does anyone know if it's possible to return an xml template with
> > > myghty?
> >
> > Yes, I do it all the time. In fact you can return just about any
> > type of text-based file even if it's nothing like XML. [You can
> > even output binary data, but that can get tricky]
> >
> >
> >
> > > I have this template
> > ...
> > > I'm calling this in my controller
> >
> > > return Response(render('/messages/mesg.myt', format='xml'),
> > > mimetype='text/xml')
> >
> > > Is this possible?
> >
> > > I found that if the xml is on one line with no returns or tabs it
> > > works and I can parse the data properly with javascript
> >
> > > however, if i format the template with tabs and returns the xml
> > > returned seems to contains null nodes in between elements and the same
> > > javascript cannot parse it.
> >
> > I'm not sure about null nodes. Have you tried looking at the XML
> > directly, say by using curl or wget?
> >
> > Anyway XML is not freeform. Whitespace between tags, which
> > includes newlines and indentation, is significant. So
> > <tag>
> > </tag>
> > is not the same thing as
> > <tag></tag>
> >
> > When you look at the DOM tree for the tag the newlines will be in
> > a Text-type node.
> >
> > If you want to avoid the extra newlines being output, be sure to end
> > your template lines with a trailing backslash, to suppress the newlines.
> >
> > In fact, unless you need readability, it's probably best to elimiate
> > ALL extra whitespace. Don't try to indent or pretty-format your
> > XML. Just run it all together on one line.
> >
> > Deron Meranda
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---