gh-149468: Add option to validate ElementTree during serialization#149469
gh-149468: Add option to validate ElementTree during serialization#149469serhiy-storchaka wants to merge 2 commits into
Conversation
|
This PR also fixes some bugs in serialization to HTML. I am going to extract them into separate issue before merging this PR. But for now, it is more convenient to review them together. |
| @@ -0,0 +1,3 @@ | |||
| Add the *validate* option to :mod:`xml.etree.ElementTree` serialization | |||
| functions, which allows to validate the element or element tree before | |||
There was a problem hiding this comment.
Suggestion on wording: "...which validates the element or element tree names and values only contain allowed/escaped characters prior to serialization"
| HTML_EMPTY = {"area", "base", "basefont", "br", "col", "embed", "frame", "hr", | ||
| "img", "input", "isindex", "link", "meta", "param", "source", | ||
| "track", "wbr"} | ||
| "track", "wbr", "plaintext"} |
There was a problem hiding this comment.
This is very deprecated, why add it?
There was a problem hiding this comment.
Because it is still supported. This is a very special case. It does not have the closing tag, and closing tags for opened elements should not be added, because they will be parsed as raw text.
* The content of comments, processing instructions and elements "xmp", "iframe", "noembed", "noframes", and "plaintext" is no longer escaped. * The "plaintext" element no longer have the closing tag. * Add support of empty attributes (with value None).
73e1b24 to
a134c0b
Compare
|
Rebased it onto #149490. |
|
|
||
|
|
||
| xml.etree.ElementTree | ||
| --------------------- |
There was a problem hiding this comment.
You should now move this entry to Doc/whatsnew/3.16.rst.
Uh oh!
There was an error while loading. Please reload this page.