RE: Relation between core DOM and HTML DOM

Don Park wrote,

> >  Document someXMLDoc = new BasicDocument();
> >  Element xmlElement = someXMLDoc.createElement("FOO");
> >  Element htmlLikeElement = someXMLDoc.createElement("TABLE");
> >
> >  if(xmlElement instanceof HTMLElement)
> >    // always false
> >
> >  if(htmlLikeElement instanceof HTMLElement)
> >    // always false
> 
> 
> In all the interface-based designs I came across, I have 
> never seen a single design which relied on the 'absence'
> of an interface.  Exactly what advantages are there to this
> 'guaranteed' lack of interface?

<HAIRSHIRT scratchiness="extreme">

Oops ... well, it was the end of a long day ...

What I *ought* to have written was,

  Document someXMLDoc = new BasicDocument();
  Element xmlElement = someXMLDoc.createElement("FOO");
  Element htmlLikeElement = someXMLDoc.createElement("TABLE");

  if(xmlElement instanceof HTMLElement)
    // possibly false (ie. implementation dependent)
  if(htmlLikeElement instanceof HTMLElement)
    // possibly false (ie. implementation dependent)

In defence the best I can say is that if you can't guarantee
that an interface *is* supported you'd be well advised to
assume that it *isn't* ... unless you want to get embroiled
in lots of hard to maintain switches on type. That's a bit
lame tho' ... mea culpa ...

</HAIRSHIRT>

Cheers,


Miles

-- 
Miles Sabin                          Cromwell Media
Internet Systems Architect           5/6 Glenthorne Mews
+44 (0)181 410 2230                  London, W6 0LJ
msabin@cromwellmedia.co.uk           England

Received on Thursday, 15 October 1998 06:22:11 UTC