Hi, I'm trying to parse a list of xml strings and so far it looks like the xml.parsers.expat is the way to go but I'm not quite sure how it works.
I'm trying to parse something similar to the following. I'd like to collect all headings and bodies and associate them in a variable (dictionary for example). How would I use the expat class to do this? <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> <note> <to>Jani</to> <from>Tovi</from> <heading>Reminder 2</heading> <body>Don't forget to bring snacks!</body> </note> .... Here's the code that I have so far based on the documents I've read: actions = test.actions # Parse stepgreen actions parser = xml.parsers.expat.ParserCreate() parser.Parse(reminderXML) print parser.StartElementHandler; This doesn't work.... (even if there's one item in the list). Could someone please point me in the right direction? I haven't found any examples of what I'd like to do and I don't understand how expat works. Thanks.
_______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
