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

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


[Martin v. Loewis]


> > In dom.ext.reader.Sgmlop.py and other places, The NS methods are
> > erroneously being used for HTML DOM manipulation.  This breaks apps
> > that are expecting the resulting nodes to have the mandated HTML DOM
> > behavior (i.e.  uppercase-normalized tagnames and the like).
>
> It seems that 4DOM currently is more generous in providing this
> behaviour than actually mandated. While I can find the text that says
> that a body element should have a tagName of "BODY", nowhere I can see
> a requirement that query function have to uppercase silently, as done,
> e.g. in
>
>     def getAttributeNode(self, name):
>         return self.attributes.getNamedItem(string.upper(name))
>
> So it seems to me that upper-casing is best done in the DOM builder,
> not in the DOM implementation.
>

The upper-casing is only for output, any comparisons of element and
attribute names are supposed to be case-insensitive   From section 1.3 of
the HTML DOM Rec
(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 is
that when comparing element or attribute names to strings the string compare
needs to be case insensitive, or the element or attribute name needs to be
converted into lowercase before comparing against a lowercase string. The
other thing is that when calling methods that are case insensitive when used
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 XHTML
documents."

Cheers,

Tom P