[XML-SIG] 4DOM HTML erroneously using NS methods

Thomas B. Passin tpassin@home.com
Sun, 20 Jan 2002 20:29:24 -0500

[Martin v. Loewis]
[Tom P]:
> > (http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-2041995112):
> >
> > "There are basically two things that need to be taken into account, one
> > that when comparing element or attribute names to strings the string
> > needs to be case insensitive, or the element or attribute name needs to
> > converted into lowercase before comparing against a lowercase string.
> > other thing is that when calling methods that are case insensitive when
> > on a HTML document (such as getElementsByTagName() and namedItem()) the
> > string that is passed in should be lower case to work on both HTML and
> > documents."
> I'm confused. Is this a requirement on DOM implementations, or on DOM
> applications? It appears that it says that it says that
> getElementsByTagName is case-insensitive. I wonder where it actually
> says so. In particular, 1.1.7 of DOM 2 Core says
> (http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-5DFED1F0)
> # The DOM has many interfaces that imply string matching. HTML
> # processors generally assume an uppercase (less often, lowercase)
> # normalization of names for such things as elements, while XML is
> # explicitly case sensitive. For the purposes of the DOM, string
> # matching is performed purely by binary comparison of the 16-bit
> # units of the DOMString. In addition, the DOM assumes that any case
> # normalizations take place in the processor, before the DOM
> # structures are built.
> So, to the contrary, it appears that the DOM explicitly disallows to
> perform case-insensitive string comparison inside the DOM
> implementation.
Good point.  The text I quoted appears in the DOM Rec, but as I re-read
those sections it does look like they are giving advice to application
developers.  It seems that they are saying that, if you want to use the
(xml) DOM with HTML documents, to lowercase all names before comparing them,
since XHTML uses lowercase names.  Presumably an HTML parser will have creat
ed a DOM document with upper-case names before you get to the point of doing


Tom P