Ignoring ampersand(&) as a special character in xml

Chris c at cdot.de
Tue Sep 6 15:55:22 EDT 2005


Thierry Lam wrote:
> Let's say I have the following xml tag:
> 
> <para role="source">a & b</para>
> 
> Currently, an xml parser will treat & as a special character.  Does
> anyone know the special characters to use around the ampersand so that
> the xml parser can treat "a & b" as a whole value?
> 
> Thanks
> Thierry
> 

Simple use the XML Entity for & which is &

	<para role="source">a & b</para>

You could use CDATA sections too but they seem to have the effect on 
people ignoring that the containing strings are actually literary what 
they seem (in this case "a & b") and not what they really are ("a & 
b")...

chris




More information about the Python-list mailing list