15.6. The Python SAX Driver Interface
In chapter 10, “Just Enough SAX,” I mentioned that the SAX API caters to the needs of parser writers as well as application developers. One powerful and flexible way to map relational database data, such as MySQL to XML, is to use a driver program that makes MySQL look like just another XML parser from an application developer's perspective.
The idea is that a SAX application developer working with the DTD above should not know or care if the data is coming from MySQL or coming from a “real” XML document. The SAX driver concept gives us a natural point at which to plug MySQL into Python SAX. After all, a central design criterion for SAX was that it should be possible to swap parsers without any source changes ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access