Next / Previous / Contents / Shipman's homepage

7. A Python interface

To help processing of files using the schema described above, we provide a Python module that reads and writes XML. To use this module, you must have these files in the current directory:

Once these files are installed, your Python script must import it with a line like this:

from birdnotes import *

Here is the general flow of a program that reads notes using this module:

  1. Instantiate a Txny object representing the aou.xml file defining the desired taxonomic arrangement of birds.

  2. Instantiate a BirdNoteSet object, passing it the Txny instance.

  3. For each XML file you want to read, call the .readFile() method on the BirdNoteSet object.

The interfaces to the BirdNoteSet class and the various other classes are defined in separate sections below. Here is a diagram showing the classes and their relationships, except for Txny which is external to this module.

In addition to the classes shown above, two classes are used throughout the structure to represent mixed content as defined in Section 5.15, “The narrative elements”.