[Zope-Coders] expat fun & games
Martijn Faassen
faassen@vet.uu.nl
Tue, 12 Feb 2002 19:26:04 +0100
Hi there,
I'm still happily wrestling expat to make ParsedXML work. I thought
things would be easy, as, on Debian linux, I can do this:
>>> import pyexpat
>>> pyexpat.__version__
'2.45'
>>> pyexpat.__file__
'/usr/lib/python2.1/lib-dynload/pyexpat.so'
By making ParsedXML use this expat, everything seems to work fine.
So, I thought, since Matt Kromer had been nice enough to include pyexpat
in the Windows build, I can enable ParsedXML to use that one on Windows,
right?
You'd think so:
(on windows)
>>> import pyexpat
>>> pyexpat.__version__
'2.45'
>>> pyexpat.__file__
'C:\\PROGRAM FILES\\ZOPE\\BIN\\DLLs\\pyexpat.pyd'
But there turns out to be a difference, causing ParsedXML on Windows to
fail:
On Linux:
>>> parser = pyexpat.ParserCreate()
>>> dir(parser)
['AttlistDeclHandler', 'CharacterDataHandler', 'CommentHandler', 'DefaultHandler', 'DefaultHandlerExpand', 'ElementDeclHandler', 'EndCdataSectionHandler', 'EndDoctypeDeclHandler', 'EndElementHandler', 'EndNamespaceDeclHandler', 'EntityDeclHandler', 'ErrorByteIndex', 'ErrorCode', 'ErrorColumnNumber', 'ErrorLineNumber', 'ExternalEntityParserCreate', 'ExternalEntityRefHandler', 'GetBase', 'GetInputContext', 'NotStandaloneHandler', 'NotationDeclHandler', 'Parse', 'ParseFile', 'ProcessingInstructionHandler', 'SetBase', 'SetParamEntityParsing', 'StartCdataSectionHandler', 'StartDoctypeDeclHandler', 'StartElementHandler', 'StartNamespaceDeclHandler', 'UnparsedEntityDeclHandler', 'XmlDeclHandler', 'ordered_attributes', 'returns_unicode', 'specified_attributes']
But on Windows the dir() list (I'm not going to type it all in, try it
yourself), is different. For instance, StartDoctypeDeclHandler, which
ParsedXML uses, is missing..
What's up with that? Now going to try to install PyXML 0.7 to see if
perhaps that fixes it on Windows..
This is pretty frustrating; portability of Python XML stuff to windows
shouldn't be this horrible!
Regards,
Martijn