File_MARC
[ class tree: File_MARC ] [ index: File_MARC ] [ all elements ]

Class: File_MARCXML

Source Location: /File_MARC-1.4.1/File/MARCXML.php

Class Overview

File_MARCBASE
   |
   --File_MARCXML

The main File_MARCXML class enables you to return File_MARC_Record objects from an XML stream or string.


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods

Class: File_MARCBASE

File_MARCBASE::__construct()
Read in MARCXML records
File_MARCBASE::getXMLWriter()
Returns the XMLWriter object
File_MARCBASE::toXMLFooter()
Returns the MARCXML collection footer
File_MARCBASE::toXMLHeader()
Initializes the MARCXML output of a record or collection of records

Class Details

[line 63]
The main File_MARCXML class enables you to return File_MARC_Record objects from an XML stream or string.


[ Top ]


Class Variables

$counter =

[line 105]

Counter for MARCXML records in a collection
  • Access: protected

Type:   int


[ Top ]

$source =

[line 91]

Source containing raw records
  • Access: protected

Type:   resource


[ Top ]

$type =

[line 98]

Source type (SOURCE_FILE or SOURCE_STRING)
  • Access: protected

Type:   int


[ Top ]

$xmlwriter =

[line 112]

XMLWriter for writing collections
  • Access: protected

Type:   XMLWriter
Overrides:   Array


[ Top ]



Method Detail

__construct (Constructor)   [line 144]

File_MARCXML __construct( string|SimpleXMLElement $source, [int $type = self::SOURCE_FILE], [string $ns = ""], [bool $is_prefix = false], [string $record_class = null])

Read in MARCXML records

This function reads in files, strings or SimpleXMLElement objects that contain one or more MARCXML records.

  1.  <?php
  2.  // Retrieve MARC records from a file
  3.  $journals = new File_MARC('journals.mrc'SOURCE_FILE);
  4.  
  5.  // Retrieve MARC records from a string (e.g. Z39 query results)
  6.  $monographs = new File_MARC($raw_marcSOURCE_STRING);
  7.  
  8.  // Retrieve MARCXML records from a string with a namespace URL
  9.  $records = new File_MARCXML($xml_dataFile_MARC::SOURCE_STRING,"http://www.loc.gov/MARC21/slim");
  10.  
  11.  // Retrieve MARCXML records from a file with a namespace prefix
  12.  $records = new File_MARCXML($xml_dataFile_MARC::SOURCE_FILE,"marc",true);
  13.  ?>


Overrides File_MARCBASE::__construct() (Read in MARCXML records)

Parameters:

string|SimpleXMLElement   $source   —  Filename, raw MARC string or SimpleXMLElement object
int   $type   —  Source of the input, either SOURCE_FILE, SOURCE_STRING or SOURCE_SIMPLEXMLELEMENT
string   $ns   —  URI or prefix of the namespace
bool   $is_prefix   —  TRUE if $ns is a prefix, FALSE if it's a URI; defaults to FALSE
string   $record_class   —  Record class, defaults to File_MARC_Record

[ Top ]

next   [line 205]

File_MARC_Record next( )

Return next File_MARC_Record object

Decodes the next MARCXML record and returns the File_MARC_Record object.

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

  • Return: next record, or false if there are no more records

[ Top ]


Documentation generated on Wed, 13 Nov 2019 12:37:08 -0500 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.