Nice. now it works
On Wednesday, December 26, 2012 7:11:53 PM UTC, Anthony wrote:
>
> def index():
> a="<circle cx='200' cy='500' r='10' />"
> return a
>
> If you return a string, web2py does not call a view but returns only that
> string. To call a view, you have to return a dict:
>
> def index():
> return dict(a="<circle cx='200' cy='500' r='10' />")
>
> Then in the view, to prevent the XML string from being escaped, you have
> to wrap it in the XML() helper:
>
> {{=XML(a)}}
>
> You might also take a look at the generic.xml view for help serializing
> data into XML.
>
> Anthony
>
> On Wednesday, December 26, 2012 1:52:54 PM UTC-5, jonas wrote:
>>
>> Hi. Is there any way to generate xml svg via controllers? svg can be made
>> by using declarative syntax, i.e xml instead of javascript. is it possible
>> to return an string containing svg xml and render it in index.html? for
>> example, a very simple function, index.py:
>>
>> def index():
>>
>> a="<circle cx='200' cy='500' r='10' />"
>>
>> return a
>>
>> (assuming that
>>
>> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "
>> http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
>> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="
>> http://www.w3.org/1999/xlink" width='800px' height='600px'>
>> {{=a}}
>> </svg>
>>
>> is already in place in index.html)
>>
>> I've tried different ways of returning xml (string,dict and TAG helper
>> function) but none works. so, is this approach possible or is it a waste of
>> time?
>>
>
--