gh-44871: Improve DOM Level 1 conformance of xml.dom.minidom - #155641
Open
serhiy-storchaka wants to merge 2 commits into
Open
gh-44871: Improve DOM Level 1 conformance of xml.dom.minidom#155641serhiy-storchaka wants to merge 2 commits into
serhiy-storchaka wants to merge 2 commits into
Conversation
It tells how many of the attributes reported to StartElementHandler were given in the start tag rather than defaulted from the DTD.
* The factory methods now raise InvalidCharacterErr if the name is not a valid XML name. * appendChild(), insertBefore() and replaceChild() now raise WrongDocumentErr if the new child was created by other document, and HierarchyRequestErr if it is the node itself or its ancestor. * Attributes defaulted in the DTD are no longer omitted when parsing, and Attr.specified now reports whether the attribute was given in the start tag. * EntityReference nodes and Document.createEntityReference() are now implemented.
Documentation build overview
6 files changed ·
|
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.
Rework of minidom-level-1-compliance.4.patch by Jason Orendorff (2007), which no longer applies: it is Python 2 source (
ur''literals), and its XML 1.0 name tables predate XML 1.0 Fifth Edition, which adopted the XML 1.1Nameproduction.InvalidCharacterErrif the name is not a valid XML name. The original patch added a new module for this;xml.is_valid_name()is used instead.appendChild(),insertBefore()andreplaceChild()now raiseWrongDocumentErrif the new child was created by other document, andHierarchyRequestErrif it is the node itself or its ancestor. The latter formerly created a cycle, in which walkingparentNodenever terminates and serialization fails withRecursionError.Attr.specifiednow reports whether the attribute was given in the start tag. It was always false before. This needs the newpyexpatmethodGetSpecifiedAttributeCount().EntityReferencenodes andDocument.createEntityReference()are now implemented.Two parts of the original patch are not included.
Document.xmlVersionexisted only to select between the XML 1.0 and 1.1 name grammars, which are now identical. Making writes tonodeValuea no-op where the DOM defines it as null conflicts with #155627, which deprecates writes to read-only attributes rather than ignoring them.Rejecting invalid names and cross-document insertions breaks code which currently succeeds, so this is documented in the porting section of What's New.