Skip to content

gh-156665: Validate namespaces in xml.dom.minidom - #156666

Open
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:gh-156665-namespace-validation
Open

gh-156665: Validate namespaces in xml.dom.minidom#156666
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:gh-156665-namespace-validation

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Aug 30, 2026

Copy link
Copy Markdown
Member

NamespaceErr is now raised by createElementNS(), createAttributeNS(), setAttributeNS() and when setting the prefix of an attribute.

Two existing tests created xmlns:python attributes with "http://www.w3.org" as the namespace URI instead of the XMLNS namespace, and are fixed here.

createElementNS(), createAttributeNS() and setAttributeNS() now raise
NamespaceErr for a malformed qualified name, for a prefix with an empty
namespace, and for illegal use of the "xml" and "xmlns" prefixes, as required
by DOM Level 2 Core.  Setting the prefix of an attribute is validated too.

Two tests used a wrong namespace URI for xmlns attributes.
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #34299912 | 📁 Comparing dbb19bd against main (26d9b25)

  🔍 Preview build  

4 files changed
± library/xml.dom.html
± library/xml.dom.minidom.html
± whatsnew/3.16.html
± whatsnew/changelog.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant