Ignoring ampersand(&) as a special character in xml

Chris c at cdot.de
Tue Sep 6 21:58:20 CEST 2005


Chris wrote:
> 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 &amp;
> 
>     <para role="source">a &amp; 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 &amp; 
> b")...

should read before posting..., of course the other way round:
some people seem to ignore the visible "a & b" is not the actual "a 
&amp; b" in CDATA sections...

> 
> chris
> 



More information about the Python-list mailing list