[Python-checkins] CVS: python/dist/src/Lib/xml/sax __init__.py,1.4,1.5
Fred L. Drake
python-dev@python.org
Mon, 18 Sep 2000 09:31:11 -0700
Update of /cvsroot/python/python/dist/src/Lib/xml/sax
In directory slayer.i.sourceforge.net:/tmp/cvs-serv19293
Modified Files:
__init__.py
Log Message:
Remove two unnecessary imports.
Update the module docstring to reflect the actual list of modules in the
xml.sax package.
Make the code better conform to the Python style guide.
Index: __init__.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/__init__.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** __init__.py 2000/09/15 18:38:47 1.4
--- __init__.py 2000/09/18 16:31:08 1.5
***************
*** 8,19 ****
This package contains the following modules:
! saxutils -- Implementation of the convenience functions normally used
! to work with SAX.
! saxlib -- Implementation of the shared SAX 2 classes.
! drv_pyexpat -- Driver that allows use of the Expat parser with the classes
! defined in saxlib.
"""
--- 8,23 ----
This package contains the following modules:
! handler -- Base classes and constants which define the SAX 2 API for
! the 'client-side' of SAX for Python.
! saxutils -- Implementation of the convenience classes commonly used to
! work with SAX.
! xmlreader -- Base classes and constants which define the SAX 2 API for
! the parsers used with SAX for Python.
+ expatreader -- Driver that allows use of the Expat parser with the
+ classes defined in saxlib.
+
"""
***************
*** 21,48 ****
from expatreader import ExpatParser
from _exceptions import SAXException, SAXNotRecognizedException, \
! SAXParseException, SAXNotSupportedException
! import xmlreader
! import saxutils
!
! def parse( filename_or_stream, handler, errorHandler=ErrorHandler() ):
! parser=ExpatParser()
! parser.setContentHandler( handler )
! parser.setErrorHandler( errorHandler )
! parser.parse( filename_or_stream )
! def parseString( string, handler, errorHandler=ErrorHandler() ):
try:
! import cStringIO
! stringio=cStringIO.StringIO
except ImportError:
! import StringIO
! stringio=StringIO.StringIO
! bufsize=len( string )
! buf=stringio( string )
!
! parser=ExpatParser()
! parser.setContentHandler( handler )
! parser.setErrorHandler( errorHandler )
! parser.parse( buf )
!
--- 25,48 ----
from expatreader import ExpatParser
from _exceptions import SAXException, SAXNotRecognizedException, \
! SAXParseException, SAXNotSupportedException
!
!
! def parse(filename_or_stream, handler, errorHandler=ErrorHandler()):
! parser = ExpatParser()
! parser.setContentHandler(handler)
! parser.setErrorHandler(errorHandler)
! parser.parse(filename_or_stream)
!
! def parseString(string, handler, errorHandler=ErrorHandler()):
try:
! from cStringIO import StringIO
except ImportError:
! from StringIO import StringIO
! if errorHandler is None:
! errorHandler = ErrorHandler()
! parser = ExpatParser()
! parser.setContentHandler(handler)
! parser.setErrorHandler(errorHandler)
! parser.parse(StringIO(string))