From 0b129fa1f5a63f3a0b0db88ea633e0de781f4aca Mon Sep 17 00:00:00 2001 From: Beatrycze Volk Date: Mon, 17 Jun 2024 18:08:39 +0200 Subject: [PATCH] Update README for ver. 0.4.0 --- README.md | 22 +++++++++++++++++++++- composer.json | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e0a2e9d..f986b14 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,13 @@ The library requires at least PHP 7.4. $modsReader = new ModsReader($this->xml); // get all titleInfo elements -$authors = $modsReader->getTitleInfos(); +$titleInfos = $modsReader->getTitleInfos(); + +// get first titleInfo element +$firstTitleInfo = $modsReader->getFirstTitleInfo(); + +// get first titleInfo element +$lastTitleInfo = $modsReader->getLastTitleInfo(); // get name elements which match to give string query $authors = $modsReader->getNames('[./mods:role/mods:roleTerm[@type="code" and @authority="marcrelator"]="aut"]'); @@ -29,6 +35,20 @@ $identifier = $authors[0]->getNameIdentifier('[@type="orcid"]'); // get string value of element $value = $identifier->getValue(); + +// get 'type' attribute of element +$type = $identifier->getType(); + +// get child elements of element +$places = []; +$originInfos = $this->modsReader->getOriginInfos('[not(./mods:edition="[Electronic ed.]")]'); +foreach ($originInfos as $originInfo) { + foreach ($originInfo->getPlaces() as $place) { + foreach ($place->getPlaceTerms() as $placeTerm) { + $places[] = $placeTerm->getValue(); + } + } +} ``` ## TODOs: diff --git a/composer.json b/composer.json index 99c5e7a..590b3f9 100644 --- a/composer.json +++ b/composer.json @@ -2,6 +2,7 @@ "name": "slub/php-mods-reader", "description": "Read MODS metadata into PHP objects that offer some convenient data extraction methods", "type": "library", + "readme": "README.md", "keywords": [ "mods", "mods-reader"