Skip to content

Commit d1e4e12

Browse files
committed
Add warning about lack of validation for xml.sax.saxutils.XMLGenerator
1 parent 89b5571 commit d1e4e12

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Doc/library/xml.sax.utils.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ or as base classes.
6161

6262
.. class:: XMLGenerator(out=None, encoding='iso-8859-1', short_empty_elements=False)
6363

64+
.. warning::
65+
:class:`~xml.sax.handler.XMLGenerator` does not validate element or
66+
attribute names. Callers must ensure that names passed to APIs conform
67+
to `XML name rules <https://www.w3.org/TR/xml/#NT-Name>`__ if passing
68+
untrusted input. Character data and attribute values are escaped,
69+
but not validated.
70+
6471
This class implements the :class:`~xml.sax.handler.ContentHandler` interface
6572
by writing SAX
6673
events back into an XML document. In other words, using an :class:`XMLGenerator`
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add warning about lack of validation for ``xml.sax.saxutils.XMLGenerator``.

0 commit comments

Comments
 (0)