Quoting Michael Glavassevich <[EMAIL PROTECTED]>:

> I imagine it was overridden because the getElementById() defined by DOM
> HTML [1] (IDs are attributes named "id") has different behaviour than the
> one in DOM Core [2] (IDs are attributes of type ID).

But the HTML4.01 DTD defines "id" as of type ID...
http://www.w3.org/TR/html4/sgml/dtd.html#coreattrs

> There probably wasn't
> much thought about making it efficient and since there's really no one
> maintaining the HTML DOM implementation it hasn't improved much over the
> years.
>

Point taken, but how much effort do you think it would be?  If the HTML4.01 DTD
defines "id" as of type ID, then couldn't Xerces track these id's in the
"identifiers" map while building the document?  I'm talking about the DOMParser
building it using an HTML parser configuration such as that provided by
NekoHTML.  Or is it up to NekoHTML to ensure this happens?  Should I be talking
to you or Andy Clark?

Ultimately, would you accept a change in HTMLDocumentImpl to let the superclass
determine the Id from it's internal "identifiers" map or would that introduce
more risk than you are willing to accept; that the parser might not populate
the "identifiers" map for HTML?  Of course, it could implemented to fall back
to existing behavior if the parent class can't find it in the "identifiers" map
(or the map is null), allowing for optimized behavior for parsers that choose to
properly populate the map and safe fallback for parsers that don't.

What do you think?

Jake

> [1] http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html.html
> [2]
> http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-getElBId
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: [EMAIL PROTECTED]
> E-mail: [EMAIL PROTECTED]
>
> Jacob Kjome <[EMAIL PROTECTED]> wrote on 09/22/2006 02:04:51 AM:
>
> >
> > I'm curious...
> >
> > If Xerces is keeping an internal Map of "identifiers" (in
> > CoreDocumentImpl), why does HTMLDocumentImpl need to override
> > getElementById(String) and recurse through the document looking for
> > an element with an "id" attribute with the value provided?  Why not
> > just look it up from the "identifiers" map?  Seems to me that would
> > be much more efficient.  Is it because the "identifiers" map doesn't
> > get populated for HTMLDocumentImpl objects?  If not, why
> > not?  getElementById(String) is such a commonly used method that it
> > would make sense to implement it as efficiently as possible, don't you
> think?
> >
> >
> > Jake
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to