MarcXml
extends AbstractSerializationFile
in package
implements
SerializationInterface
MARCXML format support class.
Tags
Interfaces, Classes, Traits and Enums
- SerializationInterface
- MARC serialization interface.
Table of Contents
- $currentXmlPath : array<string|int, mixed>
- Current XML element path
- $fileName : string
- Current file
- $messageCallback : callable
- Message callback
- $xml : XMLReader
- XML Reader for current file
- canParse() : bool
- Check if this class can parse the given MARC string
- canParseCollection() : bool
- Check if the serialization class can parse the given MARC collection string
- canParseCollectionFile() : bool
- Check if the serialization class can parse the given MARC collection file
- collectionFromString() : array<string|int, mixed>
- Parse MARC collection from a string into an array
- fromString() : array<string|int, mixed>
- Parse MARCXML string
- getNextRecord() : string
- Get next record from the file or an empty string on EOF
- openCollectionFile() : void
- Open a collection file
- rewind() : void
- Rewind the collection file
- setMessageCallback() : void
- Set message callback
- toString() : string
- Convert record to a MARCXML string
- loadXML() : SimpleXMLElement
- Load XML into SimpleXMLElement
- message() : void
- Output a message
Properties
$currentXmlPath
Current XML element path
protected
array<string|int, mixed>
$currentXmlPath
= []
$fileName
Current file
protected
string
$fileName
= ''
$messageCallback
Message callback
protected
callable
$messageCallback
= null
$xml
XML Reader for current file
protected
XMLReader
$xml
= null
Methods
canParse()
Check if this class can parse the given MARC string
public
static canParse(string $marc) : bool
Parameters
- $marc : string
-
MARC
Return values
bool —canParseCollection()
Check if the serialization class can parse the given MARC collection string
public
static canParseCollection(string $marc) : bool
Parameters
- $marc : string
-
MARC
Return values
bool —canParseCollectionFile()
Check if the serialization class can parse the given MARC collection file
public
static canParseCollectionFile(string $file) : bool
Parameters
- $file : string
-
File name
Return values
bool —collectionFromString()
Parse MARC collection from a string into an array
public
static collectionFromString(string $collection) : array<string|int, mixed>
Parameters
- $collection : string
-
MARC record collection in the format supported by the serialization class
Tags
Return values
array<string|int, mixed> —fromString()
Parse MARCXML string
public
static fromString(string $marc) : array<string|int, mixed>
Parameters
- $marc : string
-
MARCXML
Tags
Return values
array<string|int, mixed> —getNextRecord()
Get next record from the file or an empty string on EOF
public
getNextRecord() : string
Tags
Return values
string —openCollectionFile()
Open a collection file
public
openCollectionFile(string $file) : void
Parameters
- $file : string
-
File name
Tags
Return values
void —rewind()
Rewind the collection file
public
rewind() : void
Tags
Return values
void —setMessageCallback()
Set message callback
public
setMessageCallback(callable $callback) : void
Parameters
- $callback : callable
-
Message callback
Return values
void —toString()
Convert record to a MARCXML string
public
static toString(array<string|int, mixed> $record) : string
Parameters
- $record : array<string|int, mixed>
-
Record data
Tags
Return values
string —loadXML()
Load XML into SimpleXMLElement
protected
static loadXML(string $xml) : SimpleXMLElement
Parameters
- $xml : string
-
XML
Tags
Return values
SimpleXMLElement —message()
Output a message
protected
message(string $msg, int $level) : void
Parameters
- $msg : string
-
Message
- $level : int
-
Error level (see https://www.php.net/manual/en/function.error-reporting.php)