Skip to content

Allow to skip XML declaration in minidom's toprettyxml / toxml / writexml #128285

@G-Guillard

Description

@G-Guillard

Feature or enhancement

Proposal:

The XML declaration is currently hardcoded in Document.writexml(), which is in turn called by toxml() and toprettyxml().

It is often convenient to use these functions to parse XML which purpose is to be inserted in another XML document, but one has to get rid of the declaration set by writexml().

It would be handy and trivial to add a default xml_declaration=True parameter, which would skip the declaration when set to False.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtopic-XMLtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions