You are here:  » Removing entries from a record


Removing entries from a record

Submitted by RodThePlod on Fri, 2006-01-13 01:44 in

Hello,

First of all - have to say that Magic Parser is great! It's saved me *lots* of hours work!

I'm reading records from an XML source that has been processed by Magic Parser and using PHP fputs() to write each record out to a file.

Trouble is, the records contain some fields that I don't want to write out to the file.

I could fputs() the entire record and then process the file afterwards to remove the lines I don't need but this is not very elegant.

How do I process the record in Magic Parser to remove one or more fields before I fputs() the output?

Thanks,

RodThePlod.

Submitted by support on Fri, 2006-01-13 08:37

Hi Rod,

You can use PHP's unset() statement against array members. For example:

unset($record["FIELDNAME"]);

...would remove the key FIELDNAME from the $record array before processing it. This would be the first thing that you do within your myRecordHandler() function.

Hope this helps!

Submitted by RodThePlod on Fri, 2006-01-13 10:34

Hi!

> Hope this helps!

It certainly does. Thanks for the quick response.

RodThePlod.