On Thu, 15 Nov 2001, Nat Pryce wrote:

> From: "Simon St.Laurent" <simonstl / simonstl.com>
> > People coming from Java may expect DOM, but even Java has JDOM and
> > DOM4J.  Perl's implementations are all over the map, and Python
> > certainly has variety.  I don't think there's anything especially
> > magical about DOM that demands a DOM implementation have high priority.
>
> DOM is really designed to support scripts that are written to manipulate an
> XML or HTML document in many different environments, in which case the DOM
> implementation will be provided by the environment. E.g. an environment
> might be a browser, or an ASP-like server.

Right! In fact that is the reason for DOM. If you have something like
JavaScript attached to a browser. The browser has parsed the page, fixed
according to its best guesses any brokeness and deviations from
well-formedness and the DTD.

The browser has now displayed the page.

Your script language now wants to access some part of the the page. eg.
Typical example would be give text input field with name attribute "fred"
the focus.

Thats where you need DOM - in the browser, not the scripting language.

Does this mean that the scripting language needs to have a DOM?

NO! The browser provides the DOM! The script language is treating the DOM
entirely as an external API.

Maybe if you were writing a browser, on which you expected to be able to
hang an arbitary scripting language, all using a single standard API
to access the DOM, then you need to create a DOM.

I don't think _anybody_ has a "mozilla-in-ruby" project on the back
burner.

Am I wrong? Can anyone think of any counter examples?

Otherwise lets have no more of this "Ruby standard XML library needs to
have the standard DOM API" talk.

The DOM API is broken by design, built to the lowest common denominator.
Its a pain and a suffering.

Ruby is the product of some very smart thinking, built to provide the
slickest neatest interfaces. Please don't waste it.

(Even if Ruby becomes the Mozilla scripting language of choice, (ie. my
prayers answered), you _still_ don't need to display the DOM api in the
Ruby XML library. You wrap the underlying mess and provide the rubyish
API to the Ruby coders!)


John Carter                             Phone : (64)(3) 358 6639
Tait Electronics                        Fax   : (64)(3) 359 4632
PO Box 1645 Christchurch                Email : john.carter / tait.co.nz
New Zealand

Indeed, the first noble truth of Buddhism, usually translated as
`all life is suffering,' is more accurately rendered `life is filled
with a sense of pervasive unsatisfactoriness.'
		-- M.D. Epstein