As I can see, you got the XML and outputed it to the view. I dont see what you want more. Tell us.
2012/3/6 Praveen Bhat <praveenbha...@gmail.com>: > Hello, > > I have come to the point where the whole XML document is returned, as u can > see in the attached file. > > I have used the following code: > > Controller: > > def index(): > import urllib2 > temp = > urllib2.urlopen('http://free.worldweatheronline.com/feed/weather.ashx?q=udupi&format=xml&num_of_days=2&key=b019cd7d6a135850110711') > tempdata = temp.read() > parseddata = XML(tempdata).xml() > return dict(parseddata = parseddata) > > View: > > > {{ for parseddata in parseddata: }} > > <l>{{=XML(parseddata)}}</li> > > {{pass}} > > I am missing something here. Could you please help. > > Regards > > > On Monday, March 5, 2012 10:14:46 PM UTC+5:30, yamandu wrote: >> >> 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 <praveenbha...@gmail.com>: >> > 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! >> אָמֵן -- Carlos J. Costa Cientista da Computação Esp. Gestão em Telecom EL MELECH NEEMAN! אָמֵן