rest25/library/xml.sax.utils.rst => rest262/library/xml.sax.utils.rst
16
17
18.. function:: escape(data[, entities])
19
20   Escape ``'&'``, ``'<'``, and ``'>'`` in a string of data.
21
22   You can escape other strings of data by passing a dictionary as the optional
23   *entities* parameter.  The keys and values must all be strings; each key will be
n24-   replaced with its corresponding value.
n24+   replaced with its corresponding value.  The characters ``'&'``, ``'<'`` and
25+   ``'>'`` are always escaped, even if *entities* is provided.
25
26
27.. function:: unescape(data[, entities])
28
29   Unescape ``'&amp;'``, ``'&lt;'``, and ``'&gt;'`` in a string of data.
30
31   You can unescape other strings of data by passing a dictionary as the optional
32   *entities* parameter.  The keys and values must all be strings; each key will be
n33-   replaced with its corresponding value.
n34+   replaced with its corresponding value.  ``'&amp'``, ``'&lt;'``, and ``'&gt;'``
35+   are always unescaped, even if *entities* is provided.
34
35   .. versionadded:: 2.3
36
37
38.. function:: quoteattr(data[, entities])
39
t40-   Similar to :func:`escape`, but also prepares *data* to be used as an attribute
t42+   Similar to :func:`escape`, but also prepares *data* to be used as an
41-   value.  The return value is a quoted version of *data* with any additional
43+   attribute value.  The return value is a quoted version of *data* with any
42-   required replacements. :func:`quoteattr` will select a quote character based on
44+   additional required replacements. :func:`quoteattr` will select a quote
43-   the content of *data*, attempting to avoid encoding any quote characters in the
45+   character based on the content of *data*, attempting to avoid encoding any
44-   string.  If both single- and double-quote characters are already in *data*, the
46+   quote characters in the string.  If both single- and double-quote characters
45-   double-quote characters will be encoded and *data* will be wrapped in double-
47+   are already in *data*, the double-quote characters will be encoded and *data*
46-   quotes.  The resulting string can be used directly as an attribute value::
48+   will be wrapped in double-quotes.  The resulting string can be used directly
49+   as an attribute value::
47
48      >>> print "<element attr=%s>" % quoteattr("ab ' cd \" ef")
49      <element attr="ab ' cd &quot; ef">
50
51   This function is useful when generating attribute values for HTML or any SGML
52   using the reference concrete syntax.
53
54   .. versionadded:: 2.2
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op