parsing "&A" in a string..

bruce bedouglas at earthlink.net
Sun Aug 31 17:06:35 EDT 2008


aha...

it's the beautifulsoup() that's taking the "&E" and giving the "&E;"...



-----Original Message-----
From: python-list-bounces+bedouglas=earthlink.net at python.org
[mailto:python-list-bounces+bedouglas=earthlink.net at python.org]On Behalf
Of Fredrik Lundh
Sent: Sunday, August 31, 2008 1:10 PM
To: python-list at python.org
Subject: Re: parsing "&A" in a string..


bruce wrote:

> a pretty simple question, i'm guessing.
> 
> i have a text/html string that looks like:
>  	....(A&E)
> 
> the issue i have is that when i parse it using xpath/node/toString,
> i get the following
> 
> ...(A&E;).

that's because your parser is interpreting the &E part as an entity 
reference, and the serializer is then adding the missing semicolon.

bare ampersands must be written as "&" in the file.

</F>

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



More information about the Python-list mailing list