(untitled: DOM and SAX models)

David Brownell david-b at pacbell.net
Sat Jul 24 20:12:26 BST 1999

----- Original Message -----
From: Chris Harris <christopher.harris at reuters.com>
To: <xml-dev at ic.ac.uk>
Sent: Wednesday, July 21, 1999 5:05 AM

> ...
> Validation of a document means ensuring that the document conforms
> to the DTD for that document.

Actually, it only means determining whether it conforms.  "Ensuring" is an
application's option; perhaps by choosing to reject nonconforming documents
rather than just to report nonconformance as potential trouble.

>    In practice, this means that the entire
> document has to fit into memory since validation cannot be completed until
> the whole document has been parsed. This fits well with the DOM model,

I can't see why, since DOM doesn't say a thing about validating or about
building a DOM tree from XML text, or even the relationship between DOM and
an XML processor (~= parser).  You may be assuming some particular API is
(or isn't) part of DOM -- careful!

>     but
> is somewhat in opposition to the SAX philosophy where most of the action
> done during the document parse.

The issue would not relate to validation, though; it'd be the architectural
issue of pipelined processing that don't impose data structure models (SAX)
or highly distinct stages segregated using one data structure (DOM).

> My question is really, for those of you who are writing XML processors
> (i.e. applications that use XML), what mode(s) do you use, and do you find
> the need for a validating SAX parser?

I use both. Note that the XML specification talks about the processor
as distinct from the application, so your terminology isn't quite right.
Not many people are writing XML "processors" any more; they're using ones
already written, as components of their applications.

For some reason, I tend to use validation more often with SAX than with
DOM, but that's probably just because of what I've done recently.

- Dave

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)

More information about the Xml-dev mailing list