I am learning how to get information from xml file and hope you can help me with this simple question.
I want to recieve all the information from the xml file. F.e here is a xml file: https://msdn.microsoft.com/en-us/library/ms762271%28v=vs.85%29.aspx
That's my code:
import urllib
import xml.etree.ElementTree as ET
x = open('books.xml')
tree = ET.parse(x)
root = tree.getroot()
print root.tag
for c in root:
print c.tag,":", c.text
for x in c:
print x.tag,":", x.text
Is there more elegant way to print all informtaion which is located in the file?