Skip to content

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

Merged
serhiy-storchaka merged 4 commits into
python:mainfrom
serhiy-storchaka:gh-54092-fragment-writexml
Sep 13, 2026
Merged

gh-54092: Implement writexml() for DocumentFragment in xml.dom.minidom#156646
serhiy-storchaka merged 4 commits 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

read-the-docs-community Bot commented Aug 30, 2026

Copy link
Copy Markdown

@serhiy-storchaka
serhiy-storchaka enabled auto-merge (squash) September 13, 2026 14:59
…ment-writexml

# Conflicts:
#	Doc/library/xml.dom.minidom.rst
#	Doc/whatsnew/3.16.rst
#	Lib/test/test_minidom.py
@serhiy-storchaka
serhiy-storchaka merged commit 9bd9c74 into python:main Sep 13, 2026
54 checks passed
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