You are here:  » Parse data within xml value


Parse data within xml value

Submitted by jp_solspot on Tue, 2010-11-09 21:25 in

Hi-

I have the following within a value in xml:
006003 006017 006035 006049 006051 006057 006061 006063 006091

Is it possible to use magic parser to pull out each of these values and insert into a table via Magic Parser?

Thanks
JP

Submitted by support on Wed, 2010-11-10 03:06

Hi JP,

Sure - within your myRecordHandler function, let's say the example data is in a field called "VALUES", you could use PHP's explode() function to extract each individual value and then process / insert into a database as required, for example:

function myRecordHandler($record)
{
  $values = explode(" ",$record["VALUES"]);
  foreach($values as $value)
  {
    // process each individual $value here
  }
}

Hope this helps!
Cheers,
David.