[Tutor] SAX and Python

Dave Kuhlman dkuhlman at rexx.com
Wed Aug 30 18:30:13 CEST 2006


On Wed, Aug 30, 2006 at 05:25:59AM -0700, Akanksha Govil wrote:
> Hi,
> 
> I have written a small code in python for reading xml using SAX.
> 
> I am importing xml.sax using the following:
> 
> from xml.sax import saxlib, saxexts
> On executing the code I get the following error:
> 
> ImportError: cannot import name saxlib
> 
> Both python-xml and pyxml are installed on my machine along with
> python 2.4.
> 

I believe that there have been a few changes to the organization of
the SAX modules and the interfaces of the classes themselves.

Attached is a simple SAX example that should help get you started,
if you haven't already groped your way through it.

Also, you will want to read the following and the pages it links
to:

    http://docs.python.org/lib/module-xml.sax.html
    http://docs.python.org/lib/module-xml.sax.xmlreader.html
    http://docs.python.org/lib/module-xml.sax.handler.html
    Etc.

Dave

-- 
Dave Kuhlman
http://www.rexx.com/~dkuhlman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_sax2.py
Type: text/x-python
Size: 1709 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tutor/attachments/20060830/c28d08b6/attachment.py 


More information about the Tutor mailing list