[XML-SIG] Specializing DOM exceptions

Fred L. Drake, Jr. fdrake@acm.org
Thu, 7 Dec 2000 09:15:18 -0500 (EST)


Paul Prescod writes:
 > The DOM documentation does not mention a Python IndexSizeErr exception.
 > That's part of the Python binding so you can only find out about it in
 > the Python documentation.

  I'll take a look at this today and see what I think the right thing
is.

Martin says:
 > (*) In DOM, childNodes does not have a []-operator; only a method
 > item(). Interestingly enough, that method is specified to return null
 > in case of an out-of-range index, not to raise INDEX_SIZE_ERR.

Paul responds:
 > That's part of the Python binding also:
...
 > I don't think returning null would be very Pythonic.

  NodeList.item(i) should return None if the recommendation says it
should return null, but NodeList[] should handle negative indexes and
raise IndexError in the appropriate Pythonic way.  The Python DOM API
is written that way as well:

http://python.sourceforge.net/devel-docs/lib/dom-nodelist-objects.html


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Digital Creations