barry
Fri May 02 04:15:39 CDT 2008
well i work on freelancer sites and one buyer had posted 3 xml files which
hr/she could not read in IE, i tried them myself it would fail on some lines
with IE giving the following error message
A semi colon character was expected. Error processing resource
'file:///C:/3Xmls/canales.es_9159529468.xml'. Line 16590, P...
once the & was replacedwith & it would move further and show a error on
another line.
The buyer wanted the errors corrected in the entire files, it was possible
to do a find/replace (carefully) in a text editor, i have no intention of
hacking and do not have the time to do so.
If you want i can send you one of those files (i do not have the permission
to do so, but that does not matter).
following is one such problem node, link is the problem node
<video>
<idvideo>Publicidad</idvideo>
<nombre>Publicidad</nombre>
<descripcion>Publicidad</descripcion>
<url>
http://www.xxxxxxxxx.tv/xxx/redir.php?pf=zoneid__18;n__ae371c90;cb__786592291</url> <link>
http://www.xxxxxxxxx.tv/ads/redir.php?clk=1&pf=zoneid__18;n__ae371c90;cb__786592291</link> <category>preroll</category> <thumbnail></thumbnail></video>"Tigger" <mccreath@bigfoot.com> wrote in messagenews:DfqdnbuoUaE0eYTVnZ2dnUVZ_oGjnZ2d@adnap.net.au...> "barry" <someone@somewhere.com> wrote in messagenews:%23RjzdDtqIHA.3568@TK2MSFTNGP04.phx.gbl...>>>> Thanks for your reply>>>> Imagine the following string>> string str = "The Quick Black&Fox & Jumped Over "e; The & LazyDog";>>>> should be>>>> string str = "The Quick Black&Fox & Jumped Over "e; The &Lazy Dog";>>>> This is a problem with a larger .xml file in which xx&xx is creating aproblems in IE>>>> In fact in have just spent over 50 minutes and managed to get someresults like this>>>> str = Regex.Replace(str, @"\b\s*(?=&[^&|"e;| & ])\b", "&",RegexOptions.None);>>>> And last but not the least i collect all answers posted to my Regexqueries for later use.>>>> Is this a case of correcting badly encoded data? Is the source dataexpected to be correctly encoded html/xml?>> It seems encoding certain "&"s while igonoring others is hacking around aproblem instead of sorting out why the source data is incorrect.>> Also, in your example you encode one "&" at "Black&Fox" while ignoringanother at "The & Lazy". So what are the rules?>> --> Tigger>
http://www.mccreath.org.uk>