[Zope-Coders] Shared.DC.xml stuff

Fred L. Drake, Jr. fred@zope.com
Fri, 31 Jan 2003 13:52:06 -0500


I'd like to remove the dcpyexpat extension from Shared.DC.xml.  This
extension is an old version of the pyexpat extension.  The only thing
that appears to use it is OSF/XMLExportImport.py (in the importXML()
function), and that doesn't have any unit tests.

Does anyone have any tests for this function?  I'd like to get some
tests into CVS before I start whacking things too much.  The patch I'd
like to make to XMLExportImport.py is this:

Index: lib/python/OFS/XMLExportImport.py
===================================================================
RCS file: /cvs-repository/Zope/lib/python/OFS/XMLExportImport.py,v
retrieving revision 1.4
diff -u -d -r1.4 XMLExportImport.py
--- lib/python/OFS/XMLExportImport.py	14 Aug 2002 21:42:56 -0000	1.4
+++ lib/python/OFS/XMLExportImport.py	31 Jan 2003 18:51:35 -0000
@@ -98,8 +98,7 @@
     return v
 
 def importXML(jar, file, clue=''):
-    import Shared.DC.xml.pyexpat.pyexpat
-    pyexpat=Shared.DC.xml.pyexpat.pyexpat
+    import xml.parsers.expat as pyexpat
     if type(file) is StringType:
         file=open(file)
     outfile=TemporaryFile()
@@ -111,6 +110,7 @@
     F.binary=1
     F.file=outfile
     p=pyexpat.ParserCreate()
+    p.returns_unicode = False
     p.CharacterDataHandler=F.handle_data
     p.StartElementHandler=F.unknown_starttag
     p.EndElementHandler=F.unknown_endtag



  -Fred

-- 
Fred L. Drake, Jr.  <fred at zope.com>
PythonLabs at Zope Corporation