You can do something like in http://web2py.com/books/default/chapter/29/5 :
Parsing
The TAG object is also an XML/HTML parser. It can read text and
convert into a tree structure of helpers. This allows manipulation
using the API above:
>>> html = '<h1>Title</h1><p>this is a <span>test</span></p>'
>>> parsed_html = TAG(html)
>>> parsed_html.element('span')[0]='TEST'
>>> print parsed_html
<h1>Title</h1><p>this is a <span>TEST</span></p>
2012/3/5 Praveen Bhat <[email protected]>:
> Hello,
>
> I am using http://worldweatheronline.com API to display weather info. The
> API returns the data in XML format.
>
> How can i render the same in a HTML page in Web2py.
>
> Link for accessing the API Data:
>
> Weather API
>
> I have done the same in PHP as following:
>
> <?
> $xml =
> simplexml_load_file('http://free.worldweatheronline.com/feed/weather.ashx?q=udupi&format=xml&num_of_days=5&key=b019cd7d6a135850110711');
> $current = $xml->xpath("/data/current_condition");
> ?>
>
> <div class="weather">
> <p><h5>Weather :</h5>
> <?= $current[0]->temp_C ?>° C,
> <?= $current[0]->weatherDesc ?></p>
> </div>
>
> How can I do the same in web2py?
>
>
> Regards,
> Praveen
>
--
Carlos J. Costa
Cientista da Computação
Esp. Gestão em Telecom
EL MELECH NEEMAN!
אָמֵן