Storing the configuration in XML files – PLIST and others
As we noted in Chapter 9, Serializing and Saving – JSON, YAML, Pickle, CSV, and XML, Python's xml package includes numerous modules that parse the XML files. Because of the wide adoption of the XML files, it often becomes necessary to convert between XML documents and Python objects. Unlike JSON or YAML, the mapping from XML is not simple.
One common way to represent the configuration data in XML is the .plist file. For more information on the .plist format, see this: http://developer.apple.com/documentation/Darwin/Reference/ManPages/man5/plist.5.html
Macintosh users can perform man plist to see this man page. The advantages of the .plist format are that it uses a few, very general tags. This makes it easy to create .plist files and parse them. Here's the sample .plist file from with our configuration parameters.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com...