msg = logentry.find('msg')
if msg is not None:
    content += '   Comments: \n        ' + msg.text + '\n\n'
else:
    content += 'No comment made.'
print(content)
if __name__ == '__main__':
    xml_data()
Python , XML AttributeError: 'NodeList' object has no attribute 'firstChild'