bruce <badoug...@gmail.com> writes: > Looking at a file -->> > http://www.marquette.edu/mucentral/registrar/snapshot/fall13/xml/BIOL_bysubject.xml> > > However, when I use elementtree: > > document = ElementTree.parse( '/apps/parseapp2/testxml.xml' ) > > I get an invalid error : not well-formed (invalid token): > > Anyone have any python suggestions as to how to proceed to parse out > the data!
I skimmed the xml.etree.ElementTree documentation and tried the following: -------------------- from urllib.request import urlopen import xml.etree.ElementTree as ET URL = 'http://www.marquette.edu/mucentral/registrar/snapshot/fall13/xml/BIOL_bysubject.xml' with urlopen(URL) as page: root = ET.fromstring(page.read()) print(next(root.iter('datetime')).text) -------------------- Output: 12/14/2013 at 3:30 am It worked as expected. Maybe something is wrong with your local copy of the xml-file. -- Felix Dietrich _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor