Hi I am trying to search an element by tag and new in reading a xml file (in python). I coded this , but it did not work
---------------------------------------------- '''This is to detect the first element and print out all that element by tag''' from xml.dom.minidom import parse from xml.etree.ElementTree import* file1="book.xml" tmptree=ElementTree() tmptree.parse(file1) items=root.getiterator() dom = parse(file1) #Find tag names for node in items : if node.tag == 'author': #Get tag print dom.getElementsByTagName ('book') #Error 1 -----------------------------------------------------------------------------' 2 Questions 1. Why can't I use dom.getElementsByTagName('book') in #Error 1? How do i print the elements ? Error- AttributeError: ElementTree instance has no attribute 'getElementsByTagName' Thanks John -- http://mail.python.org/mailman/listinfo/python-list