Deitel Presents Parsing XML with xml.sax in Python Programming
This Deitel™ article discusses how to process an XML document using the Simple API for XML (SAX). We present a small XML document and implement a Python class that can parse the document with the SAX, using features from the Python standard library. The Python program enables the user to enter the filename of an XML document and a tag name and then searches the document for any matching tags. Readers should be familiar with basic python, exception handling, object-oriented programming (e.g., classes and inheritance) and XML The code examples included in this article show readers programming examples using the Deitel™ signature Live-Code™ Approach, which presents all concepts in the context of complete working programs followed by the screen shots of the actual inputs and outputs.