Hello.

I used this code to get the resultset of a select as xml

def export_xml(rows):
    idx=range(len(rows.colnames))
    colnames=[]
    for item in rows.colnames:
        colnames.append('column')
    datos=[]
    for row in rows.response
<https://181.40.113.10/examples/global/vars/response>:
        datos.append(TAG
<https://181.40.113.10/examples/global/vars/TAG>['row'](*[TAG
<https://181.40.113.10/examples/global/vars/TAG>[colnames[i]](row[i])
for i in idx]))
    return str(TAG
<https://181.40.113.10/examples/global/vars/TAG>.data((TAG
<https://181.40.113.10/examples/global/vars/TAG>.variable(*datos,
_name='A name for your XML'))))

def index():
    response 
<https://181.40.113.10/examples/global/vars/response>.headers['Content-Type']='application/xml'
    return export_xml(db().select(db.mytable.ALL))


then just call the generic xml view to expose response in xml format.

Hope this can help you!


Fabio



2012/9/10 devrunner <[email protected]>

> I wanted to return a xml similar to this :
> <Trade>
>   <TradeNo></TradeNo>
>   <Volume></Volume>
>   <Description></Description>
>   <etc...>
> <Trade>
>
> using a SOAP WebService. The example i'm seeing is just for primitive
> datatypes, I wanted to have a user defined object. Is this possible? Thanks.
>
>  --
>
>
>
>

-- 



Reply via email to