[XML-SIG] pyxml minidom: I can remove and append, but not replace

Andrew Clover and-xml@doxdesk.com
Tue, 22 Apr 2003 15:22:55 +0000


Joseph Reagle <reagle@mit.edu> wrote:

> if feature:
>     book.replaceChild(feature,r_title)
> else:
>     book.appendChild(r_title)

Whoops! Very common mistake, this - you've got the order of the parameters
to replaceChild the wrong way round. For reasons known only to W3C, the
newChild parameter goes first.

> xml.dom.NotFoundErr: Node does not exist in this context

Because it's looking for 'r_title' to be a child node of 'book' in order to
remove it, but it's not there.

-- 
Andrew Clover
mailto:and@doxdesk.com
http://www.doxdesk.com/