473,386 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

RE: parsing "&A" in a string..

Hi Fredrick

Thanks for the reply. But since I don't have control of the initial text, is
there something with python that will strip/replace this...

or are you saying I should do a search/replace on the "&" char with the
"amp&;" prior to parsing??

-----Original Message-----
From: py*****************************************@python .org
[mailto:py***************************************** @python.org]On Behalf
Of Fredrik Lundh
Sent: Sunday, August 31, 2008 1:10 PM
To: py*********@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

Aug 31 '08 #1
0 1386

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Eric Osman | last post by:
Hi, I'm looking for a javascript function that will convert input such as this: <CLUB Code=" into this: &lt;CLUB Code=&quot;
5
by: Mateusz Loskot | last post by:
Hi, I'd like to ask how XML parsers should handle attributes which consists of &quot; entity as value. I know XML allows to use both: single and double quotes as attribute value terminator. That's...
4
by: barney | last post by:
Hello, I' m using .NET System.Xml.XmlDOcument. When I do the following: XmlDocument xml = new XmlDocument(); xml.Load("blah"); .... xml.Save("blub"); I've got the problem that the following...
5
by: martin | last post by:
Hi, I would be extremly grateful for some help on producing an xml fragemt. The fragment that I wish to produce should look like this <Addresses> <Address>&qout;Somebody's Name&quot;...
14
by: Arne | last post by:
A lot of Firefox users I know, says they have problems with validation where the ampersand sign has to be written as &amp; to be valid. I don't have Firefox my self and don't wont to install it only...
13
by: Ragnar | last post by:
Hi, 2 issues left with my tidy-work: 1) Tidy transforms a "&amp;" in the source-xml into a "&" in the tidied version. My XML-Importer cannot handle it 2) in a long <title>-string a wrap is...
0
by: bruce | last post by:
Hi. 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
0
by: Fredrik Lundh | last post by:
bruce wrote: 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 "&amp;" in...
1
by: bruce | last post by:
aha... it's the beautifulsoup() that's taking the "&E" and giving the "&E;"... -----Original Message----- From: python-list-bounces+bedouglas=earthlink.net@python.org On Behalf Of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.