There is nothing wrong with your code.

Controller
-----------------

def guildRoster():
    url = 'http://www.wowarmory.com/guild-info.xml?r=Moon
+Guard&gn=Zen'
    header = { 'User-Agent' : 'Mozilla/5.0 Gecko/20070219 Firefox/
2.0.0.2'}
    req = urllib2.Request(url, '', header)
    return dict(results=XML(urllib2.urlopen(req).read()))

View
-------------
{{extend 'site_template.html'}}

<h2 class="title">Guild Roster</h2>
<div class="entry"><p>{{=results}}</p>
</div>

Make sure:
- urllib2.urlopen(req).read() contains something
- look at the page source


On Dec 5, 2:25 am, Kenneth Lundström <kenneth.t.lundst...@gmail.com>
wrote:
> This just a crazy idea but would it be better to move the XML() into the
> view so return would look like:
> return dict(results=urllib2.urlopen(req).read())
>
> and view:
>
> <div class="entry"><p>{{=XML(results)}}</p>
>
> Kenneth
>
> I am trying to display some XML that has been screen scraped I want to
> display it as HTML in my code but for some reason its not working. It
> appears in the HTML source code but not being displayed any ideas
>
>
>
> > Controller
> > -----------------
>
> > def guildRoster():
> >     url = 'http://www.wowarmory.com/guild-info.xml?r=Moon+Guard&gn=Zen
> > <http://www.wowarmory.com/guild-info.xml?r=Moon+Guard&gn=Zen>'
> >     header = { 'User-Agent' : 'Mozilla/5.0 Gecko/20070219
> > Firefox/2.0.0.2 <http://2.0.0.2>'}
> >     req = urllib2.Request(url, '', header)
> >     return dict(results=XML(urllib2.urlopen(req).read()))
>
> > View
> > -------------
> > {{extend 'site_template.html'}}
>
> > <h2 class="title">Guild Roster</h2>
> > <div class="entry"><p>{{=results}}</p>
>
> > </div>
>
> > Cheers ty
>
>

Reply via email to