[XML-SIG] Another SAX Suggestion

Paul Prescod paul@prescod.net
Tue, 04 May 1999 17:23:28 -0500


Walter Underwood wrote:
> 
> I would slightly prefer a base that did nothing, with a supplied
> subclass that wrote to stderr. The stream parameter wouldn't be
> useful in our code, since our log interface isn't a stream.

Let me go back in my time machine. Presto, the proposal is changed to meet
your needs. Here's how to use the base that does nothing:

class MyHandler( EntityResolver, DTDHandler, DocumentHandler ):
	def warning ():
		logit()
	def error():
		logit()
	def fatalError():
		logit()

> We just don't like modifying the guts of libraries to get there.

You don't have to modify anything. Just override a method. HandlerBase
exists precisely so that you can override its methods. By default it is
useless.

> We're on the same page here, but I'd rather see the stderr stuff
> used in the sample code. Most of those filters will be a thousand
> lines of code added to the sample code anyway.

A simple SAX app is only 5 lines of code because it depends on HandlerBase
as the "reusable sample code." But you are right, if we don't change this
then we definately have to change the test code and demo programs because
now they do the wrong thing.

-- 
 Paul Prescod  - ISOGEN Consulting Engineer speaking for only himself
 http://itrc.uwaterloo.ca/~papresco

The first three Noble Truths of Python:
  All that is not Python is suffering.
  The origin of suffering lies in the use of not-Python.
  The cessation of suffering can be achieved by not using not-Python.
http://www.pauahtun.org/4nobletruthsofpython.html