[XML-SIG] getDOMImplementation() extension

Martin v. Loewis martin@v.loewis.de
30 Oct 2002 09:23:02 +0100


"Fred L. Drake, Jr." <fdrake@acm.org> writes:

> I've just checked in an extension to the getDOMImplementation()
> function provided by the xml.dom package.  The extension is that the
> "features" argument can now accept a string that lists the features
> that are being requested as well as a sequence of pairs; the syntax of
> the string is brain-dead simple (modulo a lack of precision in the DOM
> Level 3 drafts, which I'll address to the DOM comments if I haven't
> already).

This all sounds good, except that I intended usage to be slightly
different: I think it should be xml.dom.getDOMImplementation, not
xml.dom.domreg.getDOMImplementation. The domreg module serves mainly
to simplifiy code sharing between PyXML and Python, even though the
__init__ files are entirely different.

> Though it's possible to use the type of the value of the "features"
> argument to determine whether to return None or raise an exception,
> that seems both fragile and rediculous.  I'm going to propose that we
> simply declare (via documentation) that the Python binding for
> getDOMImplementation() raises ImportError instead of returning None.
> I wanted to bring the issue up here before doing that since that
> doesn't fall into the same pattern as the rest of the binding and does
> diverge from the W3C specification (however draft it may be).

The function would deviate from the other DOM functions in another
respect: It requires a keyword argument if you only want to pass
features.

So I would leave this as-is (raise ImportError), until
a) somebody complains, AND
b) the W3C draft becomes a recommendation.

When that happens, we can again reconsider.

Regards,
Martin