summaryrefslogtreecommitdiffstats
path: root/Doc/lib/xmlsaxutils.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/lib/xmlsaxutils.tex')
-rw-r--r--Doc/lib/xmlsaxutils.tex24
1 files changed, 22 insertions, 2 deletions
diff --git a/Doc/lib/xmlsaxutils.tex b/Doc/lib/xmlsaxutils.tex
index 2ff1471..0048485 100644
--- a/Doc/lib/xmlsaxutils.tex
+++ b/Doc/lib/xmlsaxutils.tex
@@ -14,13 +14,33 @@ functions that are commonly useful when creating SAX applications,
either in direct use, or as base classes.
\begin{funcdesc}{escape}{data\optional{, entities}}
- Escape \&, <, and > in a string of data.
+ Escape \character{\&}, \character{<}, and \character{>} in a string
+ of data.
You can escape other strings of data by passing a dictionary as the
- optional entities parameter. The keys and values must all be
+ optional \var{entities} parameter. The keys and values must all be
strings; each key will be replaced with its corresponding value.
\end{funcdesc}
+\begin{funcdesc}{quoteattr}{data\optional{, entities}}
+ Similar to \function{escape()}, but also prepares \var{data} to be
+ used as an attribute value. The return value is a quoted version of
+ \var{data} with any additional required replacements.
+ \function{quoteattr()} will select a quote character based on the
+ content of \var{data}, attempting to avoid encoding any quote
+ characters in the string. If both single- and double-quote
+ characters are already in \var{data}, the double-quote characters
+ will be encoded and \var{data} will be wrapped in doule-quotes. The
+ resulting string can be used directly as an attribute value:
+
+\begin{verbatim}
+>>> print "<element attr=%s>" % quoteattr("ab ' cd \" ef")
+<element attr="ab ' cd &quot; ef">
+\end{verbatim}
+
+ \versionadded{2.2}
+\end{funcdesc}
+
\begin{classdesc}{XMLGenerator}{\optional{out\optional{, encoding}}}
This class implements the \class{ContentHandler} interface by
writing SAX events back into an XML document. In other words, using