You are here:  » Repeating item


Repeating item

Submitted by Anapurn on Tue, 2006-03-07 15:44 in

My feed has - amongst other things - a repeting element as follows:

The magicparser read that as:

CHANNEL/ITEM/YWEATHER:FORECAST-CODE
CHANNGEL/ITEM/YWEATHER:FORECAST@1-CODE

The first element I'm able to catch with:

wf1code = '".mysql_real_escape_string( $record ["CHANNEL/YWEATHER:FORECAST-CODE"] )."'

But I'm not able to catch the second element with:

wf2code = '".mysql_real_escape_string( $record ["CHANNEL/YWEATHER:FORECAST@1-CODE"] )."'

Thank you very much for your help.

Submitted by Anapurn on Tue, 2006-03-07 15:47

The disappeard code again:

<yweather:forecast day="Tue" date="07 Mar 2006" low="-4" high="0" text="Snow Showers Late" code="46" />
<yweather:forecast day="Wed" date="08 Mar 2006" low="5" high="6" text="Rain/Snow" code="5" />

Submitted by support on Tue, 2006-03-07 15:57

Hi There,

Have you downloaded the latest version of Magic Parser, as this repeating element resolution using @n has only been included as of this morning.

If you have an older version; whilst the demo script on this website will show the segregation the version you have may not.

I'll continue doing some tests to check that there is no reason why key names containing @ shouldn't be picked up using the code you posted - which looks fine...

Submitted by support on Tue, 2006-03-07 16:07

Hi again,

I just tested with the following code - could you possibly try this with your current weather.xml containing the items above.

<?php
  
require("MagicParser.php");
  function 
myRecordHandler($record)
  {
    print 
"<p>".$record["YWEATHER:FORECAST-CODE"]."</p>";
    print 
"<p>".$record["YWEATHER:FORECAST@1-CODE"]."</p>";
  }
  
$result MagicParser_parse("weather.xml","myRecordHandler","xml|RSS/CHANNEL/ITEM/");
?>

If the above doesn't work; would it be possible for you to email me the XML document you're using (reply to your Magic Parser registration code email) and i'll try it on exactly the same file...

Thanks,
David.