[XML-SIG] Re: [4suite] Disentangling StylesheetReader from Ft.Lib

Uche Ogbuji uche.ogbuji@fourthought.com
Sun, 13 May 2001 13:31:18 -0600


"Martin v. Loewis" wrote:
> 
> I've tried to update my 4XSLT port to use the 4Suite 0.11 code base,
> only to discover that the StyleseetReader class is now much stronger
> connected to Ft.Lib than before, in particular to classes from
> pDomletteReader, and their specific instance attributes.

This is to provide shared code, which, oddly enough, you advocate
below.  Some of the routines could indeed be moved into a generic
handler that goes into xml.utils.

> I took the approach of providing alternative base classes to the ones
> provided by pDomlette, but that soon became a desaster since none of
> the minidom/pulldom classes bear any relationship to how the
> PyExpatReader and Handler classes work.

This could all be helped by using mix-in classes in xml.utils.  Note
that I mean *real* mix-in classes, that is, classes that provide
implementation but not interface (a disturbing chunk of the Python
community seems to think that mixing in is just plain old inheritance).

> I'd still like pursue my attempt of integrating 4XSLT to work without
> Ft.Lib, and pDomlette in particular, but I'd need some advise here.  I
> feel that I miss some grand picture in all these classes, and how they
> are connected. It seems that the authors of the code lose track, too,
> with code duplication all over the place.

Of course: the code is not all polished, but I must note that what you
complained above in your first para was actually a step that eliminated
a *great* deal of duplicated code from StylesheetReader.

The solution is to move the common code somewhere accessible from PyXML.

> So my question is: Is all this complexity really necessary? Would it
> be possible to simplify things by breaking down processing in multiple
> processing steps? It seems to me that all StylesheetReader does is to
> create a DOM tree, except that it creates StylesheetElement nodes
> where a normal DOM build would create Element nodes.

Wow.  I'd count this a huge oversimplification.  The Stylesheet reader
does a great deal that most readers needn't worry about, as I'd think
would be obvious from a glance at te code.

> If this is really
> all it does, I could propose some dramatic code reduction.


-- 
Uche Ogbuji                               Principal Consultant
uche.ogbuji@fourthought.com               +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