[XML-SIG] Py-ish PySax Suggestion #2

Paul Prescod paul@prescod.net
Mon, 26 Apr 1999 16:00:42 -0500


I would like to suggest that we copy the *mllib start_foo convention for
PySAX. Here's what a HandlerBase.StartElement would look like for that:

        def startElement( self, tagname, attrs ):
                method = getattr( self, "start_"+tagname, None)
                if method:
                        method( attrs )
                else:
                        self.startUnknownElement( tagname, attrs )

        def endElement( self, tagname, attrs ):
                method = getattr( self, "end_"+tagname, None)
                if method:
                        method()
                else:
                        self.startUnknownElement( tagname )


def startUnknownElement( self, tagname, attrs ):
        pass

def endUnknownElement( self, tagname ):
        pass

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

Company spokeswoman Lana Simon stressed that Interactive 
Yoda is not a Furby. Well, not exactly. 

"This is an interactive toy that utilizes Furby technology," 
Simon said. "It will react to its surroundings and will talk." 
  - http://www.wired.com/news/news/culture/story/19222.html