[XML-SIG] Re: saxlib 1.0beta

Andrew Kuchling akuchlin@cnri.reston.va.us
Tue, 5 May 1998 11:49:17 -0400 (EDT)


Lars Marius Garshol writes (in private e-mail):
>Andrew Kuchling wrote (about using the SAX implementation with xmllib):
>>         Another thing I noticed: how would you go about changing the
>> available entity definitions?  That is, I want to handle a £
>> entity, or something else.  Is the accepted way of doing this going to
>> be parser-specific? 
>
>No. The accepted way to do it is this:
>
><!DOCTYPE myrootelement [
>  <!ENTITY dollar "$"> <!-- German keyboards don't have pound :-->
>]>
>
>This will make conformant non-validating parsers (xmlproc, XP and some
>others, but not xmllib) insert $ whenever they see &dollar;.

	OK.  To handle this, you could override the handle_doctype()
method, so saxlib's drv_xmllib could do that.  On the other hand,
if it's required for conformance, perhaps this behaviour should be
added to xmllib.py, so that simple uses of xmllib are still as
conformant as possible.  Opinions?

>[AMK]
>> Right now you'd do it for xmllib by changing the
>> entitydefs attribute of the XMLParser object, so it's handled outside
>> of SAX. 
>
>This is because xmllib does not really read the internal doctype, which
>it (according to the letter of the standard) should.

>[AMK]
>> Does SAX really not define anything for processing entities?
>
>Only for external entities where you can remap the system identifier
>(what non-SGML-ers call a URI).
>
>Since XML provides a way to handle this I don't think SAX should do
>it.

-- 
A.M. Kuchling			http://starship.skyport.net/crew/amk/
It was a wasted life, but God forbid that one should be hard upon it, or upon
anything in this world that is not deliberately and coldly wrong . . .
    -- Charles Dickens, in a letter to his friend John Forster.