gh-159637: Fix renaming an attribute to a prefixed name in minidom (GH-159638) Document.renameNode() set the prefix before the namespace URI, so the prefix was validated against the old namespace URI of the attribute and a valid rename was rejected with NamespaceErr. The attribute had already been removed from its element by then, so a rejected rename also lost it. Now the namespace URI is set first and the prefix is checked before the attribute is removed.