Tue 30 Apr 2013
Python 101 – Intro to XML Parsing with ElementTree
Posted by Mike under Cross-Platform, Python, Web
[6] Comments
If you have followed this blog for a while, you may remember that we’ve covered several XML parsing libraries that are included with Python. In this article, we’ll be continuing that series by taking a quick look at the ElementTree library. You will learn how to create an XML file, edit XML and parse the XML. For comparison’s sake, we’ll use the same XML we used in the previous minidom article to illustrate the differences between using minidom and ElementTree. Here is the original XML:
< ?xml version="1.0" ?> <zappointments reminder="15"> <appointment> <begin>1181251680</begin> <uid>040000008200E000</uid> <alarmtime>1181572063</alarmtime> <state></state> <location></location> <duration>1800</duration> <subject>Bring pizza home</subject> </appointment> </zappointments>
Now let’s dig into the Python! (more…)
