can I use element tree for handling special characters in xml text?

hackingKK hackingkk at
Wed Jul 27 13:16:31 CEST 2011

Hello all.
I have been waiting a lot to ask this question and I did ask some days 
back but probably could not put it the proper way.
I want to know how I can safely include special characters like & or > 
in xml text?
For example I store a small xml file containing list of organisations.
Many   names have an "&"  in the name as in brian & turner.
so the xml noad will be <orgname> brian & turner </orgname>
But I know this won't work directly.
my code naturally fails when I try to insert such data.
Can any one suggest the right way of parsing this kind  of strings and 
treat & like characters as part of the literal string?
Hope my question is clear this time.
Happy hacking.

More information about the Python-list mailing list