[XML-SIG] Minidom bugs/questions

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Mon, 5 Feb 2001 08:45:24 +0100

> I think we should also look at merging minidom and pDomlette.  Both are
> supposed to be "mini" and I think they both support about the same sets
> of functionality.  No sense keeping both of them around.  I can look at
> the differences and try to merge them.

I never quite understood where the "p" in pDomlette came from. To
date, pDomlette is just 200 lines longer than minidom, so yes, merging
them is a genuine option. Bear in mind that a new Python release is
upcoming, and that the final beta release is probably the last point
to add missing features (i.e. bug corrections with regard to DOM
conformance). It is not inherently wrong to include a more complete
version of minidom with PyXML, but it would be nice if it was stable
after 2.1.

As for the differences, I wonder what to do with the
auto-normalization feature of pDomlette. I can't figure out what
exactly that means: auto-normalization during parsing, or
auto-normalization during insertion of nodes. While I can see that it
is useful, I'm concerned about standards compliance here.

> > > It appears to be a common trick to allow null in createDocument,
> > > so that the first element found during parsing can be introduced
> > > with appendChild, but that appears to be non-conforming
> > > (somebody please correct me if it is [conforming, I meant]).
> >
> > I think it is, even though 4DOM does this.  Mike or Jeremy will
> > probably remind me if I'm missing something.  From what I see of
> > the readers, we don't need this convenience.
> It was originally there for the readers and to allow a user to
> create a document with out a document type.  I don't think the
> readers need this functionality any more (I'd have to look at all of
> them).

I feel some misunderstanding here. I'm talking about code like

        if ownerDoc == None:
            dt = implementation.createDocumentType('', '', '')
            self._ownerDoc = implementation.createDocument('', None, dt)
            self._rootNode = self._ownerDoc

(from xml.dom.ext.reader.Sax), in particular about the invocation of
createDocument with a null qualifiedName. I could not find any
permission in the DOM spec for such usage, and Xerces/C++ has code like

something::createDocument(DOMString& uri, DOMString& qualifiedName, DocumentType*dt){
  Document *d = new DocumentImpl(dt);
  d->appendChild(new ElementImpl(uri, qualifiedName);
  return d;

I.e. they create an element unconditionally, whereas
4DOM.DOMImplementation creates it only if qualifiedName.