Skip to content

gh-54092: Implement writexml() for DocumentFragment in xml.dom.minidom - #156646

Open
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:gh-54092-fragment-writexml
Open

gh-54092: Implement writexml() for DocumentFragment in xml.dom.minidom#156646
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:gh-54092-fragment-writexml

Conversation

@serhiy-storchaka

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

Copy link
Copy Markdown
Member

DocumentFragment was the only serializable node type without a writexml() method, so toxml() and toprettyxml() failed with AttributeError for document fragments. It was documented as implemented since GH-12677.

The fragment writes its children at the current indentation, without adding a level of indentation for itself, as it has no tag.

…minidom

toxml() and toprettyxml() now work for document fragments.  They write
the children of the fragment, without adding a level of indentation.
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #34298073 | 📁 Comparing dc86e6d against main (fcf0a98)

  🔍 Preview build  

3 files changed
± 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