[XML-SIG] Providing a DOMImplementationFactory
Sun, 04 Feb 2001 23:19:37 -0700
"Martin v. Loewis" wrote:
> 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?)
> - 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 firstname.lastname@example.org, 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).
I like this approach. It is the one I recommended to Jeremy for the
XPath interface and I wouldn't mind seeing it used for all of the xml
libraries (XPath, XPointer, DOM, etc).
+1 for me
> Please comment.
> XML-SIG maillist - XML-SIG@python.org
Mike Olson Principal Consultant
email@example.com (303)583-9900 x 102
Fourthought, Inc. http://Fourthought.com
Software-engineering, knowledge-management, XML, CORBA, Linux, Python