On Fri, Feb 22, 2008 at 6:41 PM, Robin Becker <[EMAIL PROTECTED]> wrote:

> Tim van der Leeuw wrote:
> > On Fri, Feb 22, 2008 at 5:17 PM, Robin Becker <[EMAIL PROTECTED]>
> wrote:
> >
> [...]
> >
> > Well -- you escape them in the save() method only when they contain XML
> > charachters like <, > ? How about that, wouldn't that work?
> >
> > --Tim
> >
> ......
> That might work, but there are all the ampersands etc etc to consider as
> well.
> So an escaped string could contain &, but so can a raw string.
> --
> Robin Becker
>

The way I see it, is that escaped XML is sure to contain ampersands, but
'real' XML is sure to contain < > brackets. If it doesn't contain any
angle-brackets, then what's XML about it - it contains no tags? ;-)

So I guess that looking for < or > will work as a heuristic, in 99.9999% of
the cases - if not more ;-)

Oh, and yes I agree with the other posters that it would be better to store
it unescaped, and escape it where you need it.

Cheers,

--Tim



>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to