Time for action - creating a dungeon adventure game

Here, we're going to look at a small adventure game based on the world00.xml file we created earlier in the chapter. The goal is to illustrate how we need to handle different tags and a larger, branching XML structure with event-driven processing. You should also notice that we need to create our own structural classes to maintain a representation of our world in memory, rather than allowing the XML system to do that for us.

  1. Create a new file and name it sax_explore.py.
  2. This is a rather long example, so we'll not provide the entire listing here. We're using the sax_explore.py file from the Packt Publishing code bundle. Save it to your current directory or enter it into your text editor.
  3. Start up ...

Get Python 2.6 Text Processing Beginner's Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.