[XML-SIG] Signature of startElement

Lars Marius Garshol larsga@garshol.priv.no
19 Sep 2000 09:27:19 +0200

* Martin v. Loewis
| FWIW, the startElement in 2.0 is defined as
|     def startElement(self, name, attrs):
|         """Signals the start of an element.
|         The name parameter contains the name of the element type as a
|         (uri ,localname) tuple, the qname parameter the raw XML 1.0
|         name used in the source document, and the attrs parameter
|         holds an instance of the Attributes class containing the
|         attributes of the element."""
| The parser does indeed pass a (uri, localname) pair to startElement,
| so it *is* capable of dealing with namespaces right now. The only
| uncertainty is the qname parameter, which is also passed and
| documented, but not listed in the base class signature.

Well, this is part of the problem with the SAX code in the Python CVS
tree right now: it is not internally consistent. There are at least
two different versions of the startElement signature, if not more.
| Now matter what change is perfomed on this API, it has to happen
| quickly.

I have changed most of what needs to change in the API on my laptop
already. I only need to test the changes and fix any problems that
show up. I can do this this week, but would like to feel that I have
the SIG (and the Python developers) behind me before I do so.
| I still can't see how a full specification of the interface would
| look like. I understand that there are supposed to be four methods,
| {start|end}Element[NS]. What are their signatures: How many
| parameters, what types have the parameters?

startElement(name, attrs): 
  name is a string, attrs an Attributes instance

startElementNS(name, qname, attrs):
  name is a (uri, localname) tuple, qname the qualified XML 1.0 name,
  and attrs an Attributes instance

  name is a string

endElementNS(name, qname):
  name is a (uri, localname) tuple, while qname is the qualified XML
  1.0 name

The Attributes interface also has to have some minor changes to fix
some performance problems Paul discovered incurred by generic
applications like DOM tree builders.

--Lars M.