1
Access a feed whose layout is like this:
<horoscope>
<date>20170627</date>
<listItem>
<item>
<signTitle begin="21/03" end="19/04">Áries</signTitle>
<content>
BNononononononononononon
</content>
<linktexto>
<![CDATA[
<a href='' target='blank'></a> ]]>
</linktexto>
<textosaida>
<![CDATA[
]]>
</textosaida>
<linksaida>
<![CDATA[
<a href='' target='blank'></a> ]]>
</linksaida>
</item>
</listItem>
</horoscope>
When parsing using the feedparser library, I want to extract the value of the tag in the "Aries" case, but instead I get the following output:
{'Begin': '21/03', 'end': '19/04'}
Which are the "Begin" and "end" tag attributes. But the internal value really doesn’t come. My code goes below:
import feedparser
d = feedparser.parse(caminho_do_xml)
for post in d.entries:
print(post.signtitle)
How can I access tag content instead of just attributes? Thank you.
You need only Aries or all the text of the elements?
– Woss