Re: DOM L2 comments, various

David Brownell <> writes:

> wrote:
> > 
> > So far, ASP syntax is the best argument I've heard for extending
> > the node types.
> Not really.  ASP is structurally not markup -- it's <%foo...%>
> constructs, or equivalent, with text that doesn't need to obey
> markup rules.  Or it was the last time I looked at it in detail.

Any ASP-aware server may want to parse them, though.

> > Parsing the content of a <script> _doesn't_ do it for me.
> It's just an "Element" after all.  Maybe HTMLScriptElement.
> Node type is ELEMENT_NODE.

No, the _content_ of the <script>.  In the DTD it's just text; in a real
application you have to parse that text according to the syntax of the
scripting language, build a parse tree, and interpret or compile it.

The point of both of these examples is that a specialized application may
want to add nodes _of its own_ to a DOM tree.  Sure, one could coerce these
into faked-up Element nodes with bizarre attributes and maybe illegal
tagnames (so you can distinguish them from _real_ elements).  Not everyone
is going to like that approach, though.

> > Re low-memory/large-document: Remember that the DOM is only an API;
> > how the data is stored behind it is up to the implementation. There
> > is room for cleverness and tradeoffs here. 
> Not a whole lot of such room, though; the API has a bit too
> much "stuff" in it.

Far _too_ much.  The DOM requires, for example, that no matter what the
implementation is, you can always access all of the nodes in the tree.  That
precludes (for example) doing a single processing pass over a (potentially
huge) document as it streams through a specialized proxy.  It's possible to
write such an application using the DOM _interfaces_, but you do a lot of
damage to the specified semantics in the process.

Let's take another example: the DOM requires that the children of an entity
reference duplicate the children of an Entity, and that an Entity is
read-only (and so presumably immutable).  That's fine, but suppose we're
dealing with an _external_ entity and we want our application to respond
appropriately when some other application rewrites the file.  We can do this
rather straightforwardly with strings and files, but not using the DOM.

Stephen R. Savitzky  <>  <>
Quote of the month:  Death is nature's way of telling you to slow down.
Chief Software Scientist, Ricoh Silicon Valley, Inc. Calif. Research Center
 voice: 650.496.5710  front desk: 650.496.5700  fax: 650.854.8740 
  home: <> URL:

Received on Monday, 4 October 1999 18:52:53 UTC