How to Edit XML with ElementTree

We'll cover the following...

Editing XML with ElementTree is also easy. To make things a little more interesting though, we’ll add another appointment block to the XML:

Press + to interact
<?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>
<appointment>
<begin>1181253977</begin>
<uid>sdlkjlkadhdakhdfd</uid>
<alarmTime>1181588888</alarmTime>
<state>TX</state>
<location>Dallas</location>
<duration>1800</duration>
<subject>Bring pizza home</subject>
</appointment>
</zAppointments>

Now let’s write some code to change each of the begin tag’s values ...

Access this course and 1400+ top-rated courses and projects.