Outline for March 12, 2018
Project: due March 19, 2018 at 12:30pm
What is XML?
Tree structure
Elements, tags, attributes, and attribute values
Example:
sample1.xml
Python and XML [
basic-xml.py
]
xml.etree.ElementTree
Parsing the tree from file input (
ET.parse()
), from a string (
ET.fromstring()
)
Referring to elements
Accessing tag names, attributes
Finding nodes in the tree
Dumping, writing the tree
Removing an element and its descendants
Changing an element’s attribute
Setting attributes
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 12, 2018 at 1:27PM
Winter Quarter 2018
You can get a PDF version of this