[XML-SIG] Converting to saxlib.py

Lars Marius Garshol larsga@ifi.uio.no
17 Apr 1998 16:50:23 +0200


* Andrew Kuchling
|
| As a trial, I'm converting the xmllib-based script I use for
| processing my quotation collections to both SAX and DOM interfaces.
| I did the SAX translation using the last experimental release of
| saxlib.zip, 

Just so you know: SAX will change. Hopefully the new spec will be
ready next week.

| 	* drv_xmllib.py doesn't override xmllib.py's unknown_entityref
| and unknown_charref functions, so errors like &asdfasdf; are quietly
| ignored.

Will fix that in the next version.
 
| 	* The parse() method takes a systemID and does
| urllib.urlopen() on it.  Shouldn't there also be a way to pass in a
| file-like object, and just have the parser read from it.

It seems there will be in the new SAX revision, but there is some
argument on how to handle the distinction between byte and character
streams. I have an idea, but I'm not sure I'll have the time to sketch
it out before the spec is frozen.

| This could be done either by adding an optional 'infile' parameter
| to parse() and only using urlopen() if it's omitted, or by adding a
| completely different method.

I think this is useful, too, and will probably add it once the spec is
finalized.
 	
| The new xmllib.py in Python 1.5.1, and the DOM package, both
| complain about having multiple top-level objects.  This also made my
| existing script break, so I put everything inside a <collection>
| element.  Anyway, saxlib.py doesn't complain about this; should it,
| or should that be left to the handleElement function written by the
| user? 

It should definitely not be detected by the user, nor should this
really be a matter for the driver. This should be detected by the
parser and the report just passed on from the driver. I remember being
vaguely muddled about the error reporting, but never resolved it since
it was just a quick sketch anyway.

Thanks for the report (I'm a bit terse here, but I'm in a hurry right
now). I'll make sure these issues are taken care of when I do the
final version.

-- 
"These are, as I began, cumbersome ways / to kill a man. Simpler, direct, 
and much more neat / is to see that he is living somewhere in the middle /
of the twentieth century, and leave him there."     -- Edwin Brock

 http://www.stud.ifi.uio.no/~larsga/      http://birk105.studby.uio.no/