[Python-checkins] CVS: python/dist/src/Lib/xml/sax __init__.py,1.1,1.2

Paul Prescod python-dev@python.org
Fri, 30 Jun 2000 21:58:50 -0700


Update of /cvsroot/python/python/dist/src/Lib/xml/sax
In directory slayer.i.sourceforge.net:/tmp/cvs-serv21246/sax

Modified Files:
	__init__.py 
Log Message:
Reference cycle fixes

Index: __init__.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/__init__.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** __init__.py	2000/06/29 19:33:43	1.1
--- __init__.py	2000/07/01 04:58:47	1.2
***************
*** 24,25 ****
--- 24,49 ----
  from _exceptions import SAXParseException
  import xmlreader
+ 
+ def parse( filename_or_stream, handler, errorHandler=ErrorHandler() ):
+     parser=ExpatParser()
+     parser.setContentHandler( handler )
+     parse.setErrorHandler( errorHandler )
+     parser.parse( filename_or_stream )
+ 
+ # this may not work yet...Expat doesn't handle buffer inputs
+ 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 )
+     parse.setErrorHandler( errorHandler )
+     parser.parse( buf )
+