document as child in DOM ??

Uche Ogbuji uche at ogbuji.net
Fri Nov 12 17:44:02 EST 2004


and-google at doxdesk.com (Andrew Clover) wrote in message news:<2c60a528.0411080154.1724f56 at posting.google.com>...
> Uche Ogbuji <uche at ogbuji.net> wrote:
> 
> [on reparenting the root element]
> 
> > 4) root_dom.documentElement = new_docelem
> 
> Unfortunately documentElement is a readonly property, so this won't
> fly. (minidom doesn't generate the expected NoModificationAllowedErr,
> but it doesn't perform the replacement either.)
> 
> You'd have to say:
> 
>   root_dom.replaceChild(new_docelem, root_dom.documentElement)

Good point.  I was thinking Domlette, where we ditch DOM's sillier
rules (we're writing an API, not a Web browser) :-)

--Uche



More information about the Python-list mailing list