replace illegal xml characters

kyosohma at gmail.com kyosohma at gmail.com
Wed Mar 21 11:16:09 EDT 2007


On Mar 21, 8:03 am, "killkolor" <gabriel.h... at gmail.com> wrote:
> > Does InDesign export broken XML documents?  What exactly is your problem?
>
> yes, unfortunately it does. it uses all possible unicode characters,
> though not all are alowed in valid xml (see link in the first post).
> in any way for my application i should be checking if the xml that
> comes in is valid and replace all non-valid characters. is there
> something out there to do this?

You might be able to use "Beautiful Soup":

http://www.crummy.com/software/BeautifulSoup/

There are also some good examples for parsing XML at
http://www.devarticles.com/c/a/XML/Parsing-XML-with-SAX-and-Python/

and the Dive Into Python site.


Mike




More information about the Python-list mailing list