You are here:  » Changing incorrect values in the feed


Changing incorrect values in the feed

Submitted by formmailer on Wed, 2008-05-21 08:58 in

Hi David,

This is not really a Magicparser issue, but I do hope you can help me.

The following feed sometimes contains >, which is being displayed as > in the output (which is technically correct):
http://www.zwedenweb.com/feed/cache.php?id=Cycletours&cachetime=1440

The best solution to fix this issue is of course fixing the feed. But since I am expecting that this will take a long time before the feed owner fixes it, I wondered if I could work around it.

So what I want to do is: if > exists in the description field, I want to display it like >.
So basically I need to change a string within an array field.

Can this be done?

Thanks in advance!!

/Jasper

P.S. The output of the feed is on http://www.zwedenweb.com/content/cycletours.php

Submitted by support on Wed, 2008-05-21 09:11

Hi Jasper,

Sure - you can just use str_replace() on the descrption field as required before you use it. I'm slightly confused here as if & has been entity decoded by the parse (as it should have been), then the resulting description should contain >. Either way, if that is what is coming out of the feed literally, then it could be changed as follows:

  $record["DESCRIPTION"] = str_replace(">",">",$record["DESCRIPTION"])

Hope this helps!
Cheers,
David.

Submitted by formmailer on Wed, 2008-05-21 09:19

Well, the XML feed says:

NIEUW> Schitterende natuur> Zweedse meren> Heerlijke schone lucht

Followed by more text

Therefore I assume that something went wrong with the input when they created the feed.

Anyway, your solution worked like a charm! Thanks!

/Jasper