@@ -14,13 +14,33 @@ \section{\module{xml.sax.saxutils} ---
1414either in direct use, or as base classes.
1515
1616\begin {funcdesc }{escape}{data\optional {, entities}}
17- Escape \& , <, and > in a string of data.
17+ Escape \character {\& }, \character {<}, and \character {>} in a string
18+ of data.
1819
1920 You can escape other strings of data by passing a dictionary as the
20- optional entities parameter. The keys and values must all be
21+ optional \var { entities} parameter. The keys and values must all be
2122 strings; each key will be replaced with its corresponding value.
2223\end {funcdesc }
2324
25+ \begin {funcdesc }{quoteattr}{data\optional {, entities}}
26+ Similar to \function {escape()}, but also prepares \var {data} to be
27+ used as an attribute value. The return value is a quoted version of
28+ \var {data} with any additional required replacements.
29+ \function {quoteattr()} will select a quote character based on the
30+ content of \var {data}, attempting to avoid encoding any quote
31+ characters in the string. If both single- and double-quote
32+ characters are already in \var {data}, the double-quote characters
33+ will be encoded and \var {data} will be wrapped in doule-quotes. The
34+ resulting string can be used directly as an attribute value:
35+
36+ \begin {verbatim }
37+ >>> print "<element attr=%s>" % quoteattr("ab ' cd \" ef")
38+ <element attr="ab ' cd " ef">
39+ \end {verbatim }
40+
41+ \versionadded {2.2}
42+ \end {funcdesc }
43+
2444\begin {classdesc }{XMLGenerator}{\optional {out\optional {, encoding}}}
2545 This class implements the \class {ContentHandler} interface by
2646 writing SAX events back into an XML document. In other words, using
0 commit comments