You would do this, for example

# in model
db.define_table('person',Field('name'))

# controller
def mydata():
     rows = db(db.person).select()
     return dict(rows=rows)

# create a view default/mydata.xml
<document>
{{for row in rows:}}<person><name>{{=row.name}}</name></person>{{pass}}
</document>

the call http://..../mydata.xml

You can also use helpers:

# controller
def mydata():
     rows = db(db.person).select()
     return TAG.document(*[TAG.person(TAG.name(row.name)) for row in rows])

On Monday, 18 May 2015 12:52:31 UTC-5, Mirek Zvolský wrote:
>
> I don't know how to write xml views.
>
> Basic content: {{from gluon.serializers import 
> xml}}{{=XML(xml(response._vars,quote=False))}}
> is not good for me, because
> just a wrapper like <document>...</document> is Ok,
> but the content which are rows from db().select() - and xml tags for the 
> single rows are escaped: &lt.item&gt.&lt.name&gt. instead of <item><name>
>
> Can I find an example or description of the xml (or of the json) view 
> somewhere?
>
> Thanks...
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to