I'm honestly not family with magic.  I can tell you in MarcEdit, the way that the process works is there is a very generic function that reads the structure of the data not trusting the information in the leader (since I find this data very un-reliable).  Then, if users want to apply a set of rules to the validation -- I apply those as a secondary process.  If you are looking to validate specific content within a record, then what you want to do in this function may be appropriate -- though you'll find some local systems will consistently fail the process.


From: Code for Libraries [[log in to unmask]] On Behalf Of William Denton [[log in to unmask]]
Sent: Wednesday, April 06, 2011 10:29 AM
To: [log in to unmask]
Subject: Re: [CODE4LIB] MARC magic for file

On 6 April 2011, Reese, Terry wrote:

> Actually -- I'd disagree because that is a very narrow view of the
> specification.  When validating MARC, I'd take the approach to validate
> structure (which allows you to then read any MARC format) -- then use a
> separate process for validating content of fields, which in my opinion,
> is more open to interpretation based on system usage of the data.

What do you think is the best way to recognize MARC files (up to some
level of validity, given all the MARC you've seen and parsed) that could
be made to work the way magic is defined?

William Denton, Toronto :