You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Editing is indeed possible using File_MARC, but I agree that it should be documented. Here's an example to get you started:
<?phprequire('vendor/autoload.php');
useScriptotek\Marc\Record;
$source = '<?xml version="1.0" encoding="UTF-8" ?> <record xmlns="http://www.loc.gov/MARC21/slim"> <leader>99999cam a2299999 u 4500</leader> <controlfield tag="001">98218834x</controlfield> <datafield tag="020" ind1=" " ind2=" "> <subfield code="a">8200424421</subfield> <subfield code="q">h.</subfield> <subfield code="c">Nkr 98.00</subfield> </datafield> </record>';
$record = Record::fromString($source);
$field = $record->query('020')->first(); // instance of Scriptotek\Marc\Fields\Field, wrapper for File_MARC_Data_Field// Deleting a subfield$subfield = $field->getSubfield('q'); // instance of File_MARC_Subfield$field->deleteSubfield($subfield);
// Updating a subfield$subfield = $field->getSubfield('c'); // instance of File_MARC_Subfield$subfield->setData('New value');
// Adding a subfield$newSubfield = newFile_MARC_Subfield('9', 'Local value');
$field->appendSubfield($newSubfield);
echo$record->toXML();
For more options, I recommend checking out the source code of File_MARC (vendor/pear/file_marc). It comes with a few examples, and the source code is very well documented.
What are the other methods of the record class? You have given XML as an example, but what are the rest of the methods? Especially those that convert into binary marc?
This plug in is excellent, but can we have a documentation for this plugin, or some example for us to read? So that it makes us easier to use
Other than that, I hope that this plug can provide interface for us to edit the fields. This plug in will be perfect if this function is implemented.
Hopefully I am not mistakenly missed those feature and actually they had existed in the plug in.
The text was updated successfully, but these errors were encountered: