Guest User

Untitled

a guest
Nov 20th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. instance_alink = root.find('{http://www.w3.org/2005/Atom}link')
  2.  
  3. import xml.etree.cElementTree as ET
  4.  
  5. tree = ET.parse('../../external_data/rss.xml')
  6. root = tree.getroot()
  7.  
  8. instance_title = root.find('channel/title').text
  9. instance_link = root.find('channel/link').text
  10. instance_alink = root.find('{http://www.w3.org/2005/Atom}link')
  11. instance_description = root.find('channel/description').text
  12. instance_language = root.find('channel/language').text
  13. instance_pubDate = root.find('channel/pubDate').text
  14. instance_lastBuildDate = root.find('channel/lastBuildDate').text
  15.  
  16. <?xml version="1.0" encoding="windows-1252"?>
  17. <rss version="2.0">
  18. <channel>
  19. <title>Filings containing financial statements tagged using the US GAAP or IFRS taxonomies.</title>
  20. <link>http://www.example.com</link>
  21. <atom:link href="http://www.example.com" rel="self" type="application/rss+xml" xmlns:atom="http://www.w3.org/2005/Atom"/>
  22. <description>This is a list of up to 200 of the latest filings containing financial statements tagged using the US GAAP or IFRS taxonomies, updated every 10 minutes.</description>
  23. <language>en-us</language>
  24. <pubDate>Mon, 20 Nov 2017 20:20:45 EST</pubDate>
  25. <lastBuildDate>Mon, 20 Nov 2017 20:20:45 EST</lastBuildDate>
  26. ....
  27.  
  28. <atom:link href="http://www.example.com" rel="self" type="application/rss+xml" xmlns:atom="http://www.w3.org/2005/Atom"/>
  29.  
  30. instance_alink = root.find('{http://www.w3.org/2005/Atom}link').attrib
Add Comment
Please, Sign In to add comment