Lecture 15: November 19, 2019

Reading: §13–13.3
Due: Homework 4, due on November 25 at 11:59pm


  1. What is XML?
    1. Tree structure
    2. Elements, tags, attributes, and attribute values
    3. Example: sample1.xml
  2. Python and XML [basic-xml.py]
    1. xml.etree.ElementTree
    2. Parsing the tree from file input (ET.parse()), from a string (ET.fromstring())
    3. Referring to elements
    4. Accessing tag names, attributes
    5. Finding nodes in the tree
    6. Dumping, writing the tree
    7. Removing an element and its descendants
    8. Changing an element’s attribute
    9. Setting attributes
  3. Example: prettyprinting XML [xmlpp.py]

UC Davis sigil
Matt Bishop
Office: 2209 Watershed Sciences
Phone: +1 (530) 752-8060
Email: [email protected]
MISSING TITLE
Version of November 18, 2019 at 8:41PM

You can also obtain a PDF version of this.

Valid HTML 4.01 Transitional Built with BBEdit Built on a Macintosh