[Tutor] general explanation of xml.sax and its usage

Isaac Hall hall@ouhep1.nhn.ou.edu
Fri May 16 15:57:05 2003


Hi Folks,

A while back I posted on here asking for ways to parse XML into a python 
dictionary.  Several people suggested xml.sax, but since the documentation 
seemed to be a bit more complex than I really needed (I only needed to get 
very simple XML) I abandoned that, and instead wrote my own little script 
that just sorted xml into a dictionary by just reading the text.  That 
worked well for its purpose, and continues to do so.  However, now for 
another utility, I need to be able to parse much more complicated XML into 
some kind of python object.  I am now looking at the docs for xml.sax, and 
still,  the docs make it appear more complicated than it probably is.  Can 
anyone point me to some sample code using xml.sax which is commented, so 
that I may see it in use.  Or just a smiplified explanation of how to use 
the objects in xml.sax would be very helpful.  

Thanks in advance

Ike

--