I think this should do the trick:
---------
@expose()
def test(self):
   message = ''' <Info>
 <InfoNode NAME="Node1" TYPE="type"/>
 <InfoNode NAME="Node2" TYPE="type"/>
 <InfoNode NAME="Node3" TYPE="type" >
 </Info>
'''
    return message
---------
then call test.xml from the client


Kind regards,
    Jasper

On Apr 15, 4:15 pm, rajasekhar911 <[email protected]> wrote:
> Hi
> Thanks for the quick reply.
> My Xml format is like this ...
> <Info>
> <InfoNode NAME="Node1" TYPE="type"/>
> <InfoNode NAME="Node2" TYPE="type"/>
> <InfoNode NAME="Node3" TYPE="type" >
> </Info>
> I have this as a string variable.
>
> I just want to pass this back as the response so that i can handle
> this with my ajax call as responseXML.
>
> when i call response.set_header it gives an error
> AttributeError: 'function' object has no attribute 'set_header'
>
> On Apr 15, 12:34 pm, "Diez B. Roggisch" <[email protected]> wrote:
>
> > rajasekhar911 schrieb:
>
> > > Hi,
>
> > > I have an application running in cherrypy. The exposed methods return
> > > an XML document which i parse to make changes to the UI.
>
> > > I want to shift this application to TG2. How can I make the TG2
> > > controller to return the XML document?
> > > Can genshi do that for me? Or should I use the TGWebServices(http://
> > > pypi.python.org/pypi/TGWebServices)?
>
> > I use genshi. It works roughly like this:
>
> > from tg import response
>
> > @expose() # no engine here, because we need control over content-type
> > def serve_xml(self, ...):
> >      template_content = load_template_content() # somehow get the
> > template, could be a string as well
> >      t = MarkupTemplate(template_content)
> >      args = create_argument_dict()
> >      response.set_header("Content-type", "whatever/you-like")
> >      return t.generate(**args).render()
>
> > Diez

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to