gh-57587: Add the namespaces parameter to the ElementTree serializer - #157523
Open
serhiy-storchaka wants to merge 3 commits into
Open
serhiy-storchaka wants to merge 3 commits into
serhiy-storchaka wants to merge 3 commits into
Conversation
…r_namespace() ValueError is now raised for an invalid prefix, for the reserved xmlns prefix, and for the xml prefix bound to other namespace or other prefix bound to the XML namespace, as the documentation always promised. Only the reserved nsN prefixes were rejected before.
…lizer tostring(), tostringlist() and ElementTree.write() accept a mapping from namespace prefixes to URIs which chooses the prefixes for this serialization, instead of the global registry of register_namespace(). Only the namespaces used in the tree are declared; the empty prefix sets the default namespace; a registered prefix which the mapping reserves for another namespace is not used.
Documentation build overview
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tostring(),tostringlist()andElementTree.write()accept a mapping from namespace prefixes to URIs which chooses the prefixes for this serialization, instead of the global registry ofregister_namespace(). Only the namespaces used in the tree are declared; the empty prefix sets the default namespace; a registered prefix which the mapping reserves for another namespace is not used.Based on #157521, which adds the validation of prefixes.