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

Sylvain Thenault Sylvain.Thenault@logilab.fr
Thu, 17 Jan 2002 12:09:44 +0100 (CET)


On Wed, 16 Jan 2002, Uche Ogbuji wrote:

> 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).  In fact:
> 
> $ grep NS\( dom/html/*
> grep: dom/html/CVS: Is a directory
> dom/html/HTMLDocument.py:    def createElementNS(self, namespace, qname):
> dom/html/HTMLElement.py:                self.attributes.setNamedItemNS(clone)
> $
> 
> These shouyldn't even be defined for HTML interfaces.

why ? Doesn't HTMLDocument inherit from the standard DOM level 2 Document?

> The problem is that it would be a bit of a chore to carefully change things 
> back so that the XML modules strictly use NS methods, and the HTML modules the 
> non-NS modules.  It would probably be easiest for whomever made the changes to 
> undo them.

I made the changes in dom/ext/reader/Sgmlop.py and
dom/html/HTMLDocument.py. Those one can easily be reverted, but I think
it'll be much longer to be sure that all XML modules strictly use
NS methods and HTML modules strictly use non NS methods. 

 Originally, I made the change in Sgmlop to be able to give to Sgmlop a
pDomlette document (which doesn't implement the non NS methods).
 Then I have overridden the createElementNS method in HTMLDocument to
delegate in the same manner as createElement, so I don't think it break
the standard HTML DOM behavior if you give to HTMLParser a HTMLDocument.

regards 

-- 
Sylvain Thenault

  LOGILAB           http://www.logilab.org