Outline for March 4, 2019

Reading: text, §11
Homework: due March 8, 2018 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]

Matt Bishop
Department of Computer Science
University of California at Davis
Davis, CA 95616-8562 USA
Last modified: Version of March 4, 2019 at 7:41AM
Winter Quarter 2019
You can get a PDF version of this