handler = open(file).read()
soup = Soup(handler)
for message in soup.findAll('message'):
    msg_attrs = dict(message.attrs)
f_user = message.find('from').user
f_user_dict = dict(f_user.attrs)
print('%s: %s [%s @ %s]' % (f_user_dict['friendlyname'], message.find(
    'text').decodeContents(), msg_attrs['date'], msg_attrs['time']))
if __name__ == '__main__':
    parseLog(sys.argv[1])
Синтаксический анализ XML в Python BeautifulSoup