MergeMarcCommand
extends Command
in package
Console command: Merge MARC records.
Tags
Table of Contents
- MARC21_NAMESPACE = 'http://www.loc.gov/MARC21/slim'
- XML namespace for MARC21.
- configure() : void
- Configure the command.
- execute() : int
- Run the command.
- findXmlFiles() : array<string|int, string>
- Find all XML files in a directory; return a sorted list.
- loadXmlContents() : SimpleXMLElement
- Load an XML file, and throw an exception if it is invalid.
- outputRecordsFromFile() : void
- Given the filename of an XML document, feed any MARC records from the file to the output stream.
- recordXmlToString() : string
- Convert a SimpleXMLElement into a string, ensuring that namespace declarations are appropriately included.
Constants
MARC21_NAMESPACE
XML namespace for MARC21.
public
mixed
MARC21_NAMESPACE
= 'http://www.loc.gov/MARC21/slim'
Methods
configure()
Configure the command.
protected
configure() : void
Return values
void —execute()
Run the command.
protected
execute(InputInterface $input, OutputInterface $output) : int
Parameters
- $input : InputInterface
-
Input object
- $output : OutputInterface
-
Output object
Return values
int —0 for success
findXmlFiles()
Find all XML files in a directory; return a sorted list.
protected
findXmlFiles(string $dir) : array<string|int, string>
Parameters
- $dir : string
-
Directory to read from
Tags
Return values
array<string|int, string> —loadXmlContents()
Load an XML file, and throw an exception if it is invalid.
protected
loadXmlContents(string $filePath) : SimpleXMLElement
Parameters
- $filePath : string
-
File to load
Tags
Return values
SimpleXMLElement —outputRecordsFromFile()
Given the filename of an XML document, feed any MARC records from the file to the output stream.
protected
outputRecordsFromFile(string $filePath, OutputInterface $output) : void
Parameters
- $filePath : string
-
XML filename
- $output : OutputInterface
-
Output stream
Return values
void —recordXmlToString()
Convert a SimpleXMLElement into a string, ensuring that namespace declarations are appropriately included.
protected
recordXmlToString(SimpleXMLElement $record) : string
Parameters
- $record : SimpleXMLElement
-
Record to reformat