Class File_MARC


The main File_MARC class enables you to return File_MARC_Record objects from a stream or string.

Located in /MARC.php (line 64)

Class Constant Summary
Variable Summary
resource $source
int $type
Method Summary
string nextRaw ()
File_MARC __construct (int $source, [ $type = self::SOURCE_FILE], string $in)
resource $source (line 115)

Source containing raw records

  • access: protected
int $type (line 122)


  • access: protected
next (line 240)

Return next File_MARC_Record object

Decodes the next raw MARC record and returns the File_MARC_Record object.

  1.  <?php
  2.  // Retrieve a set of MARC records from a file
  3.   $journals new File_MARC('journals.mrc'SOURCE_FILE);
  5.  // Iterate through the retrieved records
  6.   while ($record $journals->next()) {
  7.      print $record;
  8.      print "\n";
  9.  }
  11.  ?>

  • return: next record, or false if there are no more records
nextRaw (line 179)

Return the next raw MARC record

Returns the next raw MARC record, unless all records already have been read.

  • return: Either a raw record or false
string nextRaw ()
Constructor __construct (line 146)

Read in MARC records

This function reads in MARC record files or strings that contain one or more MARC records.

  1.  <?php
  2.  // Retrieve MARC records from a file
  3.   $journals new File_MARC('journals.mrc'SOURCE_FILE);
  5.  // Retrieve MARC records from a string (e.g. Z39 query results)
  6.   $monographs new File_MARC($raw_marcSOURCE_STRING);
  7.  ?>

File_MARC __construct (int $source, [ $type = self::SOURCE_FILE], string $in)
  • string $in: Name of the file, or a raw MARC string
  • int $source: Source of the input, either SOURCE_FILE or SOURCE_STRING
  • $type
Class Constants
DIRECTORY_ENTRY_LEN = 12 (line 96)

Length of the Directory

END_OF_FIELD = "\x1E" (line 86)

Hexadecimal value for End of Field

END_OF_RECORD = "\x1D" (line 91)

Hexadecimal value for End of Record

LEADER_LEN = 24 (line 101)

Length of the Leader

MAX_RECORD_LENGTH = 99999 (line 106)

Maximum record length

SOURCE_FILE = 1 (line 71)

MARC records retrieved from a file

SOURCE_STRING = 2 (line 76)

MARC records retrieved from a binary string

SUBFIELD_INDICATOR = "\x1F" (line 81)

Hexadecimal value for Subfield indicator

Documentation generated on Mon, 01 Jan 2007 23:44:41 -0500 by phpDocumentor 1.3.1