Re: Comments on DOM2 CR

Jeff Mackay wrote:
> 
> >>       Since a Document's context is mostly defined by the
> >> DOMImplementation, we put the factory there. We could have put it on
> >> DocumentType, but DocumentType is optional.
> >
> > And anyway, DocumentType as factory for Document would be wrong
> > since the contained object can't create its container.
> 
> Maybe another abstraction is in order.  How about introducing a
> 'DocumentSchema' interface that represents a specific class of documents.

What sort of schema?  RELAX, RDF, SOX1, SOX2, MS-Schema, W3C-Schema, ... ?

In any case, support for all of those would be a post-L2 issue, since
many of them aren't even stable yet.


> I think this would eliminate the chicken and egg problem.

Nope, see my original posting on the chicken/egg problem and you'll
see why anything short of having the Document be the factory for its
DocumentType is not practical:

  http://lists.w3.org/Archives/Public/www-dom/1999OctDec/0263.html

There's a direct translation to schemas, too -- except that it's
likely worse.  Anyone reading a document isn't going to know the
schema to use until it's partly parsed, just like they're not going
to know the DocumentType to use until "late" either.  With DTDs you
only need to read through the root element start tag.

With schemas, depending on how they're associated with the document,
you may need to read much more deeply into the document text before
you can start to create the DOM Document object.  For example, if a
schema were wholly embedded in the document, you'd have major trouble.

- Dave

Received on Monday, 6 March 2000 13:35:12 UTC