[XML-SIG] Providing a DOMImplementationFactory
Sun, 04 Feb 2001 21:50:37 -0700
> The DOM level 3 draft proposes a mechanism for Java to locate a
> DOMImplementation object. In short, Java programs can invoke
> which loads the implementation defined in the property
> org.w3c.dom.DOMImplementation. Should Python offer a similar
> mechanism? If so, how should it work?
> I can think of the following strategy:
> - offer two functions,
> xml.dom.registerDOMImplementation(name, implementation)
> That is not really a factory, but rather a locator (should that be
> an implementation factory?)
I think it should be a factory, because I've just been thinking about the
ability to set properties non-globally on DOM implementations. For instance,
I think 4DOM should come with the mutation event system disabled unless
support for this is set as a property.
A factory would be a perfect place to set such properties.
> - In getDOMImplementation, use various approaches of returning an
> * if a name was given, and an implementation with that name was
> registered, return it. Well-known names should be published by
> posting to email@example.com, and subsequently recorded in
> * if no name is given, but the PYTHON_DOM environment variable is set,
> this variable names a module which should have an .implementation
> attribute; this is then used. I don't know whether it is good or bad
> that Python does not provide Java-style properties...
> * if no name was given, and attempt to return a "best" implementation
> should be done, where best means "most featureful". Not sure how
> to compute this, though.
> - The implementation of xml.dom.__init__ would provide a number of
> pre-registered DOM implementations, which would always include
> minidom and would include 4DOM if PyXML is installed.
> - add-on packages (like 4Suite, or Zope) can install .pth files which
> register additional DOM implementations (starting with Python 2.1).
Sounds good enough to try out.
Uche Ogbuji Principal Consultant
firstname.lastname@example.org +1 303 583 9900 x 101
Fourthought, Inc. http://Fourthought.com
4735 East Walnut St, Ste. C, Boulder, CO 80301-2537, USA
Software-engineering, knowledge-management, XML, CORBA, Linux, Python