What is XML? Wikipedia says: Extensible Markup Language (XML) is a markup language that defines a set of rules for encoding documents in a format which is both human-readable and machine-readable.
GPX is an XML format for exchanging GPS data
Example: Winnipeg.gpx recorded using MyTracks on cell phone
KML for plotting things on Google Earth (Example: NCEDC earthquakes )
SVG for vector graphics (Example: simple.svg)
from lxml import etree
with open('simple.svg') as f:
doc = etree.fromstring( f.read() )
for item in doc:
print( item )
print('\t',item.attrib )
And of course, HTML
Many sources provide data in their own ad-hoc XML format. Example: real-time Chicago bus information
with open('getBusesForRoute.xml') as f:
doc = etree.fromstring( f.read() )
type(doc)
for item in doc:
print( type(item) )
for item in doc[:4]:
print( item.tag, item.attrib )
for jtem in item:
print('\t',jtem.tag)