xml.dom.minidom implements the namespace methods of DOM Level 2, but never raises NamespaceErr:
>>> doc.createElementNS(None, "p:e") # a prefix without a namespace
>>> doc.createElementNS("http://x", "xml:e") # the xml prefix in other namespace
>>> doc.createElementNS("http://x", "p:p:e") # a malformed qualified name
>>> doc.createAttributeNS("http://x", "xmlns") # xmlns in other namespace
>>> elem.setAttributeNS(None, "p:a", "v")
All these cases are required to raise NAMESPACE_ERR by DOM Level 2 Core and by the "validate and extract" algorithm of the WHATWG DOM Standard, which adds one more case: a name in the XMLNS namespace which is not xmlns.
The same checks are already implemented in DOMImplementation.createDocument() and createDocumentType(), they are only missing in the factory methods of Document and Element.
Also, prefix is writable and not validated (elem.prefix = "q:r" is accepted, as is the xml prefix in other namespace). Note that in the WHATWG DOM Standard prefix is read-only.
Linked PRs
xml.dom.minidomimplements the namespace methods of DOM Level 2, but never raisesNamespaceErr:All these cases are required to raise
NAMESPACE_ERRby DOM Level 2 Core and by the "validate and extract" algorithm of the WHATWG DOM Standard, which adds one more case: a name in the XMLNS namespace which is notxmlns.The same checks are already implemented in
DOMImplementation.createDocument()andcreateDocumentType(), they are only missing in the factory methods ofDocumentandElement.Also,
prefixis writable and not validated (elem.prefix = "q:r"is accepted, as is thexmlprefix in other namespace). Note that in the WHATWG DOM Standardprefixis read-only.Linked PRs