Re: Comments on DOM 2

keshlam@us.ibm.com wrote:
> 
> The problem here is that some folks want to be able to adjust their DOM's
> behavior based on which XML-based language is being processed -- which
> means they need to make this decision based on the DTD or schema.

Or namespaces of elements being created, in absence of DTD or schema.

Then there are the folk who want to adjust their application's behavior
instead of adjusting the DOM's behavior!!


>	  The
> standard object-oriented approach to this would be to select different
> subclasses of the DOM for these different behaviors... but that decision
> would have to be made no later than the object's constructor.

Well ... it's one way to do it, and one known for inflexibility.
It's not "the standard OO approach" by any means.

Were there a "standard OO approach" it'd be a generic container
("Document" in DOM) which uses specialized factories and contents.

There's a direct mapping between that and XML syntax:  XML is the
container, and inside it are specializations (DTD, namespace, schema,
etc) that aren't known till part way through parsing.

The cleanest solution is be to have the Document delegate some other
object (in this case, DocumentType) as the "real" factory.  It'd not
work for the HTML DOM, but it's bad to take that as a good precedent
since HTML isn't an eXtensible Markup Language.

- Dave

Received on Wednesday, 1 March 2000 15:11:35 UTC