HowTo Fix illegal chars in xml-documents??

Thomas Weholt thomas at cintra.no
Mon Feb 26 03:38:47 EST 2001


Hi,

I'm trying to "convert" alot of legacy information into collection of
xml-documents. In the old data there are alot of characters that are illegal
if used in the character part of the XML, like &, ;, < and >.  I've tried to
make a quick-fix for this, to swap these characters with the proper
HTML-alternative, like ; for ; etc. but haven't found a really good way
of doing this. I need to be able to swap the old chars back too, but that's
not very important now. Does anybody have a clue or a piece of code to get
me going? As of now, a great deal of the converted documents are not proper
xml-documents and will not get parsed at all.

Thanks in advance,
Thomas





More information about the Python-list mailing list