escaping illegal characters in XML

Sandy Norton sandskyfly at hotmail.com
Sat Jan 11 08:16:33 EST 2003


Question:

What's the most robust way to escape illegal characters when outputing
XML using the python standard library (or PyXML)?

Context:

I've written a websucker that extracts links and urls from various
news sites using "from xml.sax.saxutils import escape" to do my
escaping and then writing out the xml file using xml.dom.minidom.
Unfortunately, I still get illegal characters embedded in the results.

Is there any foolproof method?

Thanks in advance for any hints and pointers.

Sandy




More information about the Python-list mailing list