You are here:  » Filter a specific attribute


Filter a specific attribute

Submitted by zenkutsu on Tue, 2009-09-22 19:30 in

Hi,
I would like to use Magicparser to get a specific attribute number. For example in following:

<USA>
<state id='1'>
<name>vermont</name>
<language>english</language>
</state>
<state id='99>
<name>california</name>
<language>english</language>
</USA>

I would like to get only state california so id='99' only.
Thanks
Zenkutsu

Submitted by support on Tue, 2009-09-22 19:33

Hello Zenkutsu,

You can simply "return" from your myRecordHandler() function based on a test to ignore any records that you don't want to process. For example;

  function myRecordHandler($record)
  {
    if ($record["STATE-ID"] <> "99") return;
    // ...
    // rest of record handler function here
    // ...
  }

Hope this helps!
Cheers,
David.