I have read a lot of noise about ElementTree but never really used it. Tonight i need to extract a bunch of GPS data from a kismet log file. Let’s give it a try
from elementtree import ElementTree data = open('Kismet-May-22-2005-4.xml','r').read() detection = ElementTree.XML(data) for node in detection.getchildren(): try: print "SSID: " + node.find('SSID').text, except AttributeError:pass #hidden SSID print "BSSID: " + node.find('BSSID').text, gps = node.find('gps-info') print "Lon: " + gps.find('max-lon').text + " Lat: " + gps.find('max-lat').text
Really simple, and seems to offer really good speed. I now have another weapon for every day work.