Re: Comments on DOM 2

Dieter Köhler wrote:
> David Brownell wrote:
> > As I'd commented in my post (archive URL above), there seems to be
> > an assumption that document type is an _external_ notion, which is
> > manifestly not the model of XML.  MIME does it that way, for a much
> > weaker notion of "type", though.
> I totally agree with your archived post, that a DTD is something
> internal to an XML document and that the DOM should has to be very
> aware of that fact.  The problem now is, that the document node does
> not represent the whole XML document, but only the part starting with
> the root tag.

Actually "Document" and "Document Element" are the two concepts you
seem to want -- "Document Element" is the root tag and its children,
"Document" contains that, along with any comments/PIs and optional DTD.

"Document" is indeed the container for an entire XML document.

> But when I was thinking about external DTDs, I found, that it might be
> better to have a more flexible solution, because it could speed up
> things if one is able to reuse the same DTD tree (Yes, DTD trees are
> not defined in DOM1 or 2, as you know, but are implemented in my
> experimental version) without having to rebuild the tree every time
> one is parsing a new document.

DOM doesn't actually facilitate sharing DOM data structures anywhere.
You can return DOM nodes that proxy to shared non-DOM objects, and some
folk do.  The problem is that each node has a unique owner (can't share
between documents) and parent or "associated element" (so can't share
within one document) node.

- Dave

Received on Wednesday, 1 March 2000 16:37:48 UTC