Not getting any output in Django for BeautifulSoup
<p>I am trying BeautifulSoup4 in Django and I parsed an XML page with it. When I try the parsing the same XML page in a python interpreter in a different way, it works fine. But in Django, I get a page as shown below.</p>

<p><a href="http://i.stack.imgur.com/hPWuk.png" rel="nofollow"><img src="http://i.stack.imgur.com/hPWuk.png" alt="enter image description here"></a></p>

<p>views.py:</p>

<pre><code>def rssfeed(request):
    list1=[]
    xmllink="https://rss.sciencedaily.com/computers_math/computer_programming.xml"
    soup=BeautifulSoup(urlopen(xmllink),'xml')
    for items in soup.find_all('item'):
        list1.append(items.title)
    context={
        "list1":list1
    }
    return render(request,'poll/rssfeed.html',context)
</code></pre>

<p>rssfeed.html:</p>

<pre><code>{% if list1 %}

&lt;ul&gt;
    {% for item in list1 %}
        &lt;li&gt;{{ item }}&lt;/li&gt;
    {% endfor %}
&lt;/ul&gt;
{% endif %}
</code></pre>

<p>What is that I am doing wrong?</p>

<p>To get text from XML, you need to call get_text() function.</p>

<p>Don't use:</p>

<pre><code>items.title
</code></pre>

<p>Use:</p>

<pre><code>items.title.get_text()
</code></pre>

<p>Also, it's recommended to use <strong>lxml</strong> for parsing. Install lxml python and use:</p>

<pre><code>soup = BeautifulSoup(urlopen(xmllink), 'lxml-xml')
</code></pre>

python django beautifulsoup render