Re: partial implementations

Joseph Kesselman/Watson/IBM wrote:
> 
> >It is my understanding that it is legal for such applications to
> >implement only some of the interfaces defined in DOM.
> 
> There are, in fact, a number of such DOM subsets out there.

Could you give some pointers?

> >For example, few legacy applications could make meaningful use of a
> >ProcessingInstruction.
> 
> The XML spec says that PIs which aren't meaningful to an application should
> be ignored by that application. They are, however, part of the document's
> Infoset, and a standard parser should put them into the DOM. You may be
> able to argue that the DOM you present to the user is not the parser's
> output, but the output of a filtering stage that has discarded the PIs...
> but to be a compliant DOM, you have to allow the programmer to explicitly
> create and insert PIs, if that's what they want to do. Also, a PI may be
> meaningful to _their_ code even it isn't meaningful to the application
> itself, so stripping out PIs may impose an unreasonable limitation on how
> they apporoach their tasks.

If you are working with an existing data structure, such as an existing
database schema, or a filesystem, and don't keep any data in memory, you
might have no reasonable way to represent a PI (or a comment, for that
matter) in the underlying data storage.
You could keep all the nodes that you cannot persist in memory, and
discard them when the application exits (or the object is destroyed)...
However, these nodes will not persist between sessions.

> If it's a compliant DOM, createProcessingInstruction should return a
> ProcessingInstruction node.

PI is defined as an Extended Interface (1.3): "As such, HTML-only DOM
implementations do not need to have objects that implement these
interfaces." Is it specified what an HTML-only implementation should do
in this case?


> Of course you can define something derived from the DOM which blocks
> inappropriate  if you really want to. But once again, the result
> would not be a fully compliant DOM implementation.

It might be outside the developer's powers to permit such insertions.
Most filesystems will not allow <FILE><DIRECTORY/></FILE>, but will
instead throw exceptions. The "veneer" DOM implementation might be able
to catch these exceptions and map them to something a DOM consumer
expects. A partial DOM implementation that also thrown I/O exceptions
(or SQL, or network) will not be a strict subset.

Ari Krupnikov

Received on Thursday, 21 September 2000 16:28:32 UTC