From c343d46699109233e661d92b739c5ccbe029dcee Mon Sep 17 00:00:00 2001 From: Ross Singer Date: Wed, 1 Aug 2018 15:31:30 -0400 Subject: [PATCH 1/7] Linting; don't cater to invalid SearchResponse docs --- .gitignore | 2 +- composer.json | 7 +- src/SRU/Client.php | 160 +++++++++++++---------------- src/SRU/Record.php | 91 ++++++++++++---- src/SRU/ScanResponse.php | 12 ++- src/SRU/SearchRetrieveResponse.php | 53 +++++----- 6 files changed, 184 insertions(+), 141 deletions(-) diff --git a/.gitignore b/.gitignore index 33832a3..1945af1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,5 @@ .idea/ atlassian-ide-plugin.xml vendor/ - +composer.phar composer.lock diff --git a/composer.json b/composer.json index fd7aaf0..c23b92b 100644 --- a/composer.json +++ b/composer.json @@ -13,11 +13,14 @@ } ], "require":{ - "php": ">=5.3.0", - "phpunit/phpunit": ">=3.7.0@stable", + "php": ">=5.4.0", "monolog/monolog": ">=1.5.0", "guzzle/guzzle":"~3.7" }, + "require-dev": { + "squizlabs/php_codesniffer": "3.*", + "phpunit/phpunit": "4.8.36" + }, "autoload":{ "psr-0": { "SRU": "src" diff --git a/src/SRU/Client.php b/src/SRU/Client.php index 96f19ce..332ba71 100644 --- a/src/SRU/Client.php +++ b/src/SRU/Client.php @@ -41,25 +41,22 @@ class Client /** * @param string $baseUrl The base URL of the SRU service - * @param array $options An array of options for the SRU service ('recordSchema', 'maximumRecords', 'httpMethod', 'version') + * @param array $options An array of options for the SRU service + * ('recordSchema', 'maximumRecords', 'httpMethod', 'version') */ - function __construct($baseUrl, $options = array()) + public function __construct($baseUrl, $options = []) { $this->baseUrl = $baseUrl; - if (isset($options['recordSchema'])) - { + if (isset($options['recordSchema'])) { $this->defaultRecordSchema = $options['recordSchema']; } - if(isset($options['maximumRecords'])) - { + if (isset($options['maximumRecords'])) { $this->defaultMaximumRecords = $options['maximumRecords']; } - if(isset($options['httpMethod'])) - { + if (isset($options['httpMethod'])) { $this->defaultHttpMethod = $options['httpMethod']; } - if(isset($options['version'])) - { + if (isset($options['version'])) { $this->defaultSRUVersion = $options['version']; } } @@ -71,18 +68,17 @@ function __construct($baseUrl, $options = array()) */ public function explain($raw = false) { - $explainResponse = $this->fetch(array("version" => $this->getDefaultSRUVersion(), "operation" => "explain")); - if ($raw == true) - { + $explainResponse = $this->fetch( + ['version' => $this->getDefaultSRUVersion(), 'operation' => 'explain'] + ); + if ($raw) { $explain = $explainResponse->getBody(); - } - else - { + } else { $explain = new \DOMDocument(); $explain->loadXML($explainResponse->getBody()); } - return ($explain); + return $explain; } /** @@ -93,9 +89,9 @@ public function explain($raw = false) * @param bool $raw * @return SearchRetrieveResponse|string */ - public function search($query, $options = array(), $raw = false) + public function search($query, $options = [], $raw = false) { - return ($this->searchRetrieve($query, $options, $raw)); + return $this->searchRetrieve($query, $options, $raw); } /** @@ -108,30 +104,29 @@ public function search($query, $options = array(), $raw = false) */ public function searchRetrieve($query, $options = array(), $raw = false) { - $options['operation'] = 'searchRetrieve'; - $options["query"] = $query; - $options["version"] = isset($options['version']) ? $options['version'] : $this->getDefaultSRUVersion(); - $options['maximumRecords'] = isset($options['maximumRecords']) ? $options['maximumRecords'] : $this->defaultMaximumRecords; - $options['startRecord'] = isset($options['startRecord']) ? $options['startRecord'] : 1; - if (isset($options['recordSchema']) || $this->defaultRecordSchema) - { - $options['recordSchema'] = isset($options['recordSchema']) ? $options['recordSchema'] : $this->defaultRecordSchema; + $defaultOptions = [ + 'version' => $this->getDefaultSRUVersion(), + 'maximumRecords' => $this->getDefaultMaximumRecords(), + 'startRecord' => 1, + 'recordPacking' => 'xml' + ]; + if ($this->defaultRecordSchema) { + $defaultOptions['recordSchema'] = $this->defaultRecordSchema; } - $options['recordPacking'] = isset($options['recordPacking']) ? $options['recordPacking'] : "xml"; - $searchRetrieveResponse = $this->fetch($options); - if ($raw == true) - { + + $searchRetrieveResponse = $this->fetch( + array_merge($defaultOptions, $options, ['operation' => 'searchRetrieve', 'query' => $query]) + ); + if ($raw) { $searchRetrieve = $searchRetrieveResponse->getBody(); - } - else - { + } else { $searchXML = new \DOMDocument(); $searchXML->loadXML($searchRetrieveResponse->getBody()); $searchRetrieve = new SearchRetrieveResponse($searchXML); } - return ($searchRetrieve); + return $searchRetrieve; } /** @@ -142,23 +137,23 @@ public function searchRetrieve($query, $options = array(), $raw = false) * @param bool $raw If true, returns the response as a string * @return SearchRetrieveResponse|string */ - public function scan($scanClause, $options = array(), $raw = false) + public function scan($scanClause, $options = [], $raw = false) { - $options['operation'] = 'scan'; - $options["scanClause"] = $scanClause; - $options["version"] = isset($options['version']) ? $options['version'] : $this->getDefaultSRUVersion(); - $options['maximumTerms'] = isset($options['maximumTerms']) ? $options['maximumTerms'] : $this->defaultMaximumRecords; - - $scanResponse = $this->fetch($options); - if ($raw == true) - { + $defaultOptions = [ + 'operation' => 'scan', + 'version' => $this->getDefaultSRUVersion(), + 'maximumTerms' => $this->getDefaultMaximumRecords() + ]; + + $scanResponse = $this->fetch( + array_merge($defaultOptions, $options, ['operation' => 'scan', 'scanClause' => $scanClause]) + ); + if ($raw) { $scan = $scanResponse->getBody(); - } - else - { + } else { $scan = new ScanResponse($scanResponse->getBody()); } - return ($scan); + return $scan; } /** @@ -169,21 +164,21 @@ public function recordSchemas() { $explain = $this->explain(); $xpath = new \DOMXPath($explain); - $xpath->registerNamespace("zs", "http://www.loc.gov/zing/srw/"); - $xpath->registerNamespace("ex", "http://explain.z3950.org/dtd/2.0/"); - - $nodes = $xpath->query("/zs:explainResponse/zs:record/zs:recordData/ex:explain/ex:schemaInfo/ex:schema"); - $schemas = array(); - foreach ($nodes as $node) - { - $schemas[$node->getAttribute("name")] = array("identifier" => $node->getAttribute("identifier")); - $titleList = $node->getElementsByTagName("title"); - foreach ($titleList as $title) - { - $schemas[$node->getAttribute("name")]["title"] = $title->nodeValue; + $xpath->registerNamespace('zs', 'http://www.loc.gov/zing/srw/'); + $xpath->registerNamespace('ex', 'http://explain.z3950.org/dtd/2.0/'); + + $nodes = $xpath->query( + '/zs:explainResponse/zs:record/zs:recordData/ex:explain/ex:schemaInfo/ex:schema' + ); + $schemas = []; + foreach ($nodes as $node) { + $schemas[$node->getAttribute("name")] = ['identifier' => $node->getAttribute('identifier')]; + $titleList = $node->getElementsByTagName('title'); + foreach ($titleList as $title) { + $schemas[$node->getAttribute('name')]['title'] = $title->nodeValue; } } - return ($schemas); + return $schemas; } /** @@ -194,22 +189,22 @@ public function indexes() { $explain = $this->explain(); $xpath = new \DOMXPath($explain); - $xpath->registerNamespace("zs", "http://www.loc.gov/zing/srw/"); - $xpath->registerNamespace("ex", "http://explain.z3950.org/dtd/2.0/"); - - $nodes = $xpath->query("/zs:explainResponse/zs:record/zs:recordData/ex:explain/ex:indexInfo/ex:index/ex:map/ex:name"); - $indexes = array(); - foreach ($nodes as $node) - { - $idx = array("set" => $node->getAttribute("set"), "name" => $node->nodeValue); + $xpath->registerNamespace('zs', 'http://www.loc.gov/zing/srw/'); + $xpath->registerNamespace('ex', 'http://explain.z3950.org/dtd/2.0/'); + + $nodes = $xpath->query( + '/zs:explainResponse/zs:record/zs:recordData/ex:explain/ex:indexInfo/ex:index/ex:map/ex:name' + ); + $indexes = []; + foreach ($nodes as $node) { + $idx = ['set' => $node->getAttribute('set'), 'name' => $node->nodeValue]; $nodeList = $node->parentNode->parentNode->getElementsByTagName('title'); - foreach ($nodeList as $title) - { + foreach ($nodeList as $title) { $idx['title'] = $title->nodeValue; } - $indexes[$node->getAttribute("set") . "." . $node->nodeValue] = $idx; + $indexes[$node->getAttribute('set') . '.' . $node->nodeValue] = $idx; } - return ($indexes); + return $indexes; } /** @@ -218,25 +213,22 @@ public function indexes() * @param array $options * @return \Guzzle\Http\Message\Response */ - protected function fetch(array $args = NULL, array $options = array()) + protected function fetch(array $args = null, array $options = []) { $client = $this->getHttpClient(); - if($this->defaultHttpMethod == 'GET') - { - if(empty($args)) - { + if ($this->defaultHttpMethod === 'GET') { + if (empty($args)) { $url = $this->getBaseUrl(); } else { - $url = $this->getBaseUrl() . "?" . http_build_query($args); + $url = $this->getBaseUrl() . '?' . http_build_query($args); } $request = $client->get($url, $args, $options); $response = $request->send(); return $response; - } else - { + } else { $request = $client->post($this->getBaseUrl(), array(), $args, $options); $response = $request->send(); @@ -325,8 +317,7 @@ public function setDefaultHttpMethod($defaultHttpMethod) */ protected function getHttpClient() { - if (!$this->httpClient) - { + if (!$this->httpClient) { $this->httpClient = new \Guzzle\Http\Client(); } return $this->httpClient; @@ -347,7 +338,4 @@ public function setDefaultSRUVersion($defaultSRUVersion) { $this->defaultSRUVersion = $defaultSRUVersion; } - } - -?> \ No newline at end of file diff --git a/src/SRU/Record.php b/src/SRU/Record.php index e0560a7..f1a2c2a 100644 --- a/src/SRU/Record.php +++ b/src/SRU/Record.php @@ -11,62 +11,109 @@ class Record protected $recordPosition; protected $recordData; + /** + * Record constructor + * + * @param \DOMDocument $doc SRU SearchRetrieve response DOMDocument + * @param \DOMNode $node SearchRetrieve result record + */ public function __construct(\DOMDocument $doc, \DOMNode $node) { $this->node = $node; $this->doc = $doc; $this->xpath = new \DOMXPath($this->doc); - $this->xpath->registerNamespace("zs", "http://www.loc.gov/zing/srw/"); + $this->xpath->registerNamespace('zs', 'http://www.loc.gov/zing/srw/'); } + /** + * Returns the SRU 'recordPacking' value, which is either 'string' or 'xml' + * + * @return string|null + */ public function packing() { - if(!$this->recordPacking) { - $nodes = $this->xpath->query("./zs:recordPacking", $this->node); - foreach($nodes as $node) { + if (!$this->recordPacking) { + $nodes = $this->xpath->query('./zs:recordPacking', $this->node); + foreach ($nodes as $node) { $this->recordPacking = $node->nodeValue; } } - return($this->recordPacking); + return $this->recordPacking; } + /** + * Returns the SRU 'recordSchema' value for the record + * + * @return string|null + */ public function schema() { - if(!$this->recordSchema) { - $nodes = $this->xpath->query("./zs:recordSchema", $this->node); - foreach($nodes as $node) { + if (!$this->recordSchema) { + $nodes = $this->xpath->query('./zs:recordSchema', $this->node); + foreach ($nodes as $node) { $this->recordSchema = $node->nodeValue; } } - return($this->recordSchema); + return $this->recordSchema; } + /** + * Returns the record's position in the result set + * + * @return string + */ public function position() { - if(!$this->recordPosition) { - $nodes = $this->xpath->query("./zs:recordPosition", $this->node); - foreach($nodes as $node) { + if (!$this->recordPosition) { + $nodes = $this->xpath->query('./zs:recordPosition', $this->node); + foreach ($nodes as $node) { $this->recordPosition = $node->nodeValue; } } - return($this->recordPosition); + return $this->recordPosition; } - public function data($raw=false) + /** + * Return the recordData contents + * + * @param boolean $raw Boolean to return the XML or text record data as text (e.g. an XML string) + * @return string|\DOMNode|\DOMElement|\DOMText + */ + public function data($raw = false) { - if(!$this->recordData) { - $nodes = $this->xpath->query("./zs:recordData", $this->node); - foreach($nodes as $node) { - $this->recordData = $node; + if (!$this->recordData) { + $nodes = $this->xpath->query('./zs:recordData', $this->node); + $valid = true; + foreach ($nodes as $node) { + if ($node->childNodes->length === 1) { + $this->recordData = $node->firstChild; + } elseif ($this->packing() === 'xml') { + $valid = false; + // The zs:recordData looks like it's containing invalid XML with more than one top level node, + // so let's create a 'dummy' wrapper node for it for the calling app to have something to work with + $recordData = new \DOMElement('recordData'); + $doc = new \DOMDocument(); + $doc->appendChild($recordData); + for ($i = 0; $i < $node->childNodes->length; $i++) { + $importNode = $doc->importNode($node->childNodes->item($i), true); + $doc->recordData->appendChild($importNode); + } + $this->doc = $doc; + $this->recordData = $recordData; + } else { + $this->recordData = new \DOMText(); + for ($i = 0; $i < $node->childNodes->length; $i++) { + $this->recordData->appendData($node->childNodes->item($i)->nodeValue); + } + } } } - if($raw && $this->packing() == "xml") { - $data = $this->doc->saveXML($this->recordData); + if ($raw) { + $data = $this->packing() === 'xml' ? $this->doc->saveXML($this->recordData) : $this->recordData->nodeValue; } else { $data = $this->recordData; } - return($data); + return $data; } } -?> diff --git a/src/SRU/ScanResponse.php b/src/SRU/ScanResponse.php index 7b2b15c..6110d97 100644 --- a/src/SRU/ScanResponse.php +++ b/src/SRU/ScanResponse.php @@ -5,14 +5,16 @@ class ScanResponse { public $doc; - function __construct($xml) + /** + * @param string|\DOMDocument $xml Scan XML response document + * @throws \InvalidArgumentException If $xml is not a string or DOMDocument + */ + public function __construct($xml) { - if(is_string($xml)) - { + if (is_string($xml)) { $this->doc = new \DOMDocument(); $this->doc->loadXML($xml); - } elseif (is_a($xml, '\DOMDocument')) - { + } elseif (is_a($xml, '\DOMDocument')) { $this->doc = $xml; } else { throw new \InvalidArgumentException('Argument must be an XML string or DOMDocument object'); diff --git a/src/SRU/SearchRetrieveResponse.php b/src/SRU/SearchRetrieveResponse.php index f44be9c..4fab167 100644 --- a/src/SRU/SearchRetrieveResponse.php +++ b/src/SRU/SearchRetrieveResponse.php @@ -25,23 +25,24 @@ class SearchRetrieveResponse protected $nextRecordPosition; /** - * @param string $xml + * @param string|\DOMDocument $xml SearchRetrieve XML response document + * @throws \InvalidArgumentException If $xml is not a string or DOMDocument */ - function __construct($xml) + public function __construct($xml) { - if(is_string($xml)) - { + if (is_string($xml)) { $this->doc = new \DOMDocument(); $this->doc->loadXML($xml); - } elseif (is_a($xml, '\DOMDocument')) - { + } elseif (is_a($xml, '\DOMDocument')) { $this->doc = $xml; } else { - throw new \InvalidArgumentException('Argument must be an XML string or DOMDocument object'); + throw new \InvalidArgumentException( + 'Argument must be an XML string or DOMDocument object' + ); } $this->xpath = new \DOMXPath($this->doc); - $this->xpath->registerNamespace("zs","http://www.loc.gov/zing/srw/"); + $this->xpath->registerNamespace('zs', 'http://www.loc.gov/zing/srw/'); } /** @@ -49,13 +50,13 @@ function __construct($xml) */ public function numberOfRecords() { - if(!$this->numberOfRecords) { - $nodes = $this->xpath->query("/zs:searchRetrieveResponse/zs:numberOfRecords"); - foreach($nodes as $node) { + if (!$this->numberOfRecords) { + $nodes = $this->xpath->query('/zs:searchRetrieveResponse/zs:numberOfRecords'); + foreach ($nodes as $node) { $this->numberOfRecords = (int) $node->nodeValue; } } - return($this->numberOfRecords); + return $this->numberOfRecords; } /** @@ -63,35 +64,37 @@ public function numberOfRecords() */ public function nextRecordPosition() { - if(!$this->nextRecordPosition) { - $nodes = $this->xpath->query("/zs:searchRetrieveResponse/zs:nextRecordPosition"); - foreach($nodes as $node) { + if (!$this->nextRecordPosition) { + $nodes = $this->xpath->query('/zs:searchRetrieveResponse/zs:nextRecordPosition'); + foreach ($nodes as $node) { $this->nextRecordPosition = (int) $node->nodeValue; } } - return($this->nextRecordPosition); + return $this->nextRecordPosition; } /** * @return Record[] */ - public function getRecords() + public function getRecords() { - if(!$this->records) - { + if (!$this->records) { $this->addRecords(); } - return($this->records); + return $this->records; } + /** + * Parses the document and adds the records from the record elements + * + * @return void + */ protected function addRecords() { - - $this->records = array(); - $nodes = $this->xpath->query("/zs:searchRetrieveResponse/zs:records/zs:record"); - foreach($nodes as $node) { + $this->records = []; + $nodes = $this->xpath->query('/zs:searchRetrieveResponse/zs:records/zs:record'); + foreach ($nodes as $node) { array_push($this->records, new Record($this->doc, $node)); } } } -?> \ No newline at end of file From e3f9387fa05d17efa13e4265e5f9d47c2694f952 Mon Sep 17 00:00:00 2001 From: Ross Singer Date: Thu, 2 Aug 2018 12:51:18 -0400 Subject: [PATCH 2/7] Tests --- composer.json | 3 +- src/SRU/Record.php | 2 +- tests/unit/RecordTest.php | 129 ++ tests/unit/SearchRetrieveResponseTest.php | 28 + tests/unit/fixtures/invalid_marcxml.xml | 280 +++++ tests/unit/fixtures/record_packing_string.xml | 174 +++ tests/unit/fixtures/record_packing_xml.xml | 154 +++ tests/unit/fixtures/valid_marcxml.xml | 1034 +++++++++++++++++ 8 files changed, 1802 insertions(+), 2 deletions(-) create mode 100644 tests/unit/RecordTest.php create mode 100644 tests/unit/SearchRetrieveResponseTest.php create mode 100644 tests/unit/fixtures/invalid_marcxml.xml create mode 100644 tests/unit/fixtures/record_packing_string.xml create mode 100644 tests/unit/fixtures/record_packing_xml.xml create mode 100644 tests/unit/fixtures/valid_marcxml.xml diff --git a/composer.json b/composer.json index c23b92b..6a882e0 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,8 @@ }, "require-dev": { "squizlabs/php_codesniffer": "3.*", - "phpunit/phpunit": "4.8.36" + "phpunit/phpunit": "4.8.36", + "pear/file_marc": "1.1.2" }, "autoload":{ "psr-0": { diff --git a/src/SRU/Record.php b/src/SRU/Record.php index f1a2c2a..010d0e3 100644 --- a/src/SRU/Record.php +++ b/src/SRU/Record.php @@ -96,7 +96,7 @@ public function data($raw = false) $doc->appendChild($recordData); for ($i = 0; $i < $node->childNodes->length; $i++) { $importNode = $doc->importNode($node->childNodes->item($i), true); - $doc->recordData->appendChild($importNode); + $doc->documentElement->appendChild($importNode); } $this->doc = $doc; $this->recordData = $recordData; diff --git a/tests/unit/RecordTest.php b/tests/unit/RecordTest.php new file mode 100644 index 0000000..7ce9321 --- /dev/null +++ b/tests/unit/RecordTest.php @@ -0,0 +1,129 @@ +getRecords()[$i]; + $this->assertInstanceOf('\SRU\Record', $record); + $this->assertEquals('xml', $record->packing()); + $this->assertEquals('dc', $record->schema()); + $this->assertEquals($i + 1, $record->position()); + $data = $record->data(); + $this->assertInstanceOf('\DOMElement', $data); + $this->assertEquals('srw_dc:dc', $data->tagName); + $this->assertEquals( + 'info:srw/schema/1/dc-schema', + $data->lookupNamespaceURI('srw_dc') + ); + $rawData = $record->data(true); + $this->assertTrue(is_string($rawData)); + $this->assertContains( + '', + $rawData + ); + } + } + + public function testParseValidStringPackingResponse() + { + $responseXml = file_get_contents(__DIR__ . '/fixtures/record_packing_string.xml'); + $searchResponse = new \SRU\SearchRetrieveResponse($responseXml); + for ($i = 0; $i < 10; $i++) { + $record = $searchResponse->getRecords()[$i]; + $this->assertInstanceOf('\SRU\Record', $record); + $this->assertEquals('string', $record->packing()); + $this->assertEquals('dc', $record->schema()); + $this->assertEquals($i + 1, $record->position()); + $data = $record->data(); + $this->assertInstanceOf('\DOMText', $data); + $this->assertContains( + '', + $data->wholeText + ); + + $rawData = $record->data(true); + $this->assertTrue(is_string($rawData)); + $this->assertContains( + '', + $rawData + ); + } + } + + public function testParseValidMarcXmlResponse() + { + $responseXml = file_get_contents(__DIR__ . '/fixtures/valid_marcxml.xml'); + $searchResponse = new \SRU\SearchRetrieveResponse($responseXml); + for ($i = 0; $i < 10; $i++) { + $record = $searchResponse->getRecords()[$i]; + $this->assertInstanceOf('\SRU\Record', $record); + $this->assertEquals('xml', $record->packing()); + $this->assertEquals('marcxml', $record->schema()); + $this->assertEquals($i + 1, $record->position()); + $data = $record->data(); + $this->assertInstanceOf('\DOMElement', $data); + $this->assertEquals('record', $data->tagName); + $this->assertEquals( + 'http://www.loc.gov/MARC21/slim', + $data->namespaceURI + ); + $this->assertTrue($data->isDefaultNamespace('http://www.loc.gov/MARC21/slim')); + $rawData = $record->data(true); + $this->assertTrue(is_string($rawData)); + $this->assertContains( + '', + $rawData + ); + $r = new \File_MARCXML($rawData, \File_MARC::SOURCE_STRING); + $recordsParsed = 0; + // @var $rec \File_MARC_Record + while ($rec = $r->next()) { + $recordsParsed++; + $this->assertNotEmpty($rec->getLeader()); + $this->assertGreaterThan(0, count($rec->getFields())); + } + $this->assertEquals(1, $recordsParsed); + } + } + + public function testParseInvalidResponse() + { + $responseXml = file_get_contents(__DIR__ . '/fixtures/invalid_marcxml.xml'); + $searchResponse = new \SRU\SearchRetrieveResponse($responseXml); + + $record = $searchResponse->getRecords()[0]; + $this->assertInstanceOf('\SRU\Record', $record); + $this->assertEquals('xml', $record->packing()); + $this->assertEquals('info:srw/schema/1/marcxml-v1.1', $record->schema()); + $this->assertEquals(1, $record->position()); + $data = $record->data(); + $this->assertInstanceOf('\DOMElement', $data); + $this->assertEquals('recordData', $data->tagName); + $this->assertEmpty($data->namespaceURI); + $this->assertFalse($data->isDefaultNamespace('http://www.loc.gov/MARC21/slim')); + $rawData = $record->data(true); + $this->assertTrue(is_string($rawData)); + $this->assertContains( + '00953nam 2200289 4500', + $rawData + ); + $rawData = str_replace('', '', $rawData); + $rawData = str_replace('', '', $rawData); + $r = new \File_MARCXML($rawData, \File_MARC::SOURCE_STRING); + $recordsParsed = 0; + // @var $rec \File_MARC_Record + while ($rec = $r->next()) { + $recordsParsed++; + $this->assertNotEmpty($rec->getLeader()); + $this->assertCount(44, $rec->getFields()); + } + $this->assertEquals(1, $recordsParsed); + } +} diff --git a/tests/unit/SearchRetrieveResponseTest.php b/tests/unit/SearchRetrieveResponseTest.php new file mode 100644 index 0000000..97303b8 --- /dev/null +++ b/tests/unit/SearchRetrieveResponseTest.php @@ -0,0 +1,28 @@ +assertEquals(3212, $searchResponse->numberOfRecords()); + $this->assertEquals('11', $searchResponse->nextRecordPosition()); + $this->assertEquals(10, count($searchResponse->getRecords())); + for ($i = 0; $i < 10; $i++) { + $this->assertInstanceOf('\SRU\Record', $searchResponse->getRecords()[$i]); + } + } + public function testParseInvalidResponse() + { + $responseXml = file_get_contents(__DIR__ . '/fixtures/invalid_marcxml.xml'); + $searchResponse = new \SRU\SearchRetrieveResponse($responseXml); + $this->assertEquals(1, $searchResponse->numberOfRecords()); + $this->assertNull($searchResponse->nextRecordPosition()); + $this->assertEquals(1, count($searchResponse->getRecords())); + $this->assertInstanceOf('\SRU\Record', $searchResponse->getRecords()[0]); + } +} diff --git a/tests/unit/fixtures/invalid_marcxml.xml b/tests/unit/fixtures/invalid_marcxml.xml new file mode 100644 index 0000000..592fdb8 --- /dev/null +++ b/tests/unit/fixtures/invalid_marcxml.xml @@ -0,0 +1,280 @@ +1.1013089097_1info:srw/schema/1/marcxml-v1.1xml00953nam 2200289 4500 +DAW25472353 +121219s2013 enka b 001 0 eng|d +9781137289254 (pbk.) + +StDuBDS +eng +StDuBDS +DAWSON + +LB2395 +.C68 2013 + +378.170281 +23 + +Cottrell, Stella. + +The study skills handbook / +Stella Cottrell. + +4th ed. + +Basingstoke : +Palgrave Macmillan, +2013. + +426 p. : +ill. ; +25 cm. + +Palgrave study skills + +Previous ed.: 2008. + +Includes bibliographical references and index. + +Study skills. +Handbooks, manuals, etc. + +Palgrave study skills. + +LTAS +LIB +MAINSTOCK +20130620 +378.170281 COT +2994689 +2994689 +BOOK +0 + +LTAS +LIB +MAINSTOCK +20130620 +378.170281 COT +2994697 +2994697 +BOOK +0 + +LTAS +LIB +MAINSTOCK +20130620 +378.170281 COT +2994705 +2994705 +BOOK +0 + +LTAS +LIB +MAINSTOCK +20130620 +378.170281 COT +2994713 +2994713 +BOOK +0 + +LTAS +LIB +MAINSTOCK +20130620 +378.170281 COT +2994721 +2994721 +BOOK +0 + +LTAS +LIB +MAINSTOCK +20130620 +378.170281 COT +2994739 +2994739 +BOOK +0 + +LTAS +LIB +MAINSTOCK +20130625 +378.170281 COT +3006145 +3006145 +BOOK +0 + +LTAS +LIB +MAINSTOCK +20130625 +378.170281 COT +3006152 +3006152 +BOOK +0 + +LTAS +LIB +MAINSTOCK +20130625 +378.170281 COT +3006160 +3006160 +BOOK +0 + +LTAS +LIB +MAINSTOCK +20130625 +378.170281 COT +3006178 +3006178 +BOOK +4 +20180924 + +LTAS +LIB +MAINSTOCK +20140513 +378.170281 COT +3090446 +3090446 +BOOK +0 + +LTAS +LIB +MAINSTOCK +20150512 +378.170281 COT +3119484 +3119484 +BOOK +0 + +LTAS +LIB +MAINSTOCK +20150602 +378.170281 COT +3124716 +3124716 +BOOK +0 + +LTAS +LIB +MAINSTOCK +20150602 +378.170281 COT +3124724 +3124724 +BOOK +0 + +LTAS +LIB +MAINSTOCK +20150602 +378.170281 COT +3124732 +3124732 +BOOK +0 + +LTAS +LIB +MAINSTOCK +20150602 +378.170281 COT +3124740 +3124740 +BOOK +0 + +LTAS +LIB +MAINSTOCK +20150602 +378.170281 COT +3124757 +3124757 +BOOK +0 + +LTAS +LIB +MAINSTOCK +20160419 +378.170281 COT +3161049 +3161049 +BOOK +4 +20180924 + +LTAS +LIB +MAINSTOCK +20160419 +378.170281 COT +3161056 +3161056 +BOOK +0 + +LTAS +LIB +MAINSTOCK +20160419 +378.170281 COT +3161064 +3161064 +BOOK +4 +20180924 + +LTAS +LIB +MAINSTOCK +20160908 +378.170281 COT +3380409 +3380409 +BOOK +0 + +LTAS +LIB +MAINSTOCK +20160908 +378.170281 COT +3380458 +3380458 +BOOK +0 + +LTAS +LIB +2 + +1:274533 + +Your essential companion for succeeding with your studies. Bestselling author Stella Cottrell equips you with the skills you need to improve your grades, build your confidence and plan for the future you want. Recognising that we each have a unique formula for success, her tried and trusted approach helps you find the key to unlock your potential. + +THE ORIGINAL AND BEST - BY THE ¾ MILLION COPY BESTSELLING AUTHOR <BR> <BR> If you are serious about succeeding with your studies, <EM> The Study Skills Handbook </EM> is for you! Stella Cottrell has helped hundreds of thousands of students to make learning easier, faster and more enjoyable. Recognising that we all have our own unique formula for success, her tried and trusted approach allows you to find the key to unlock your potential and develop the skills you need to improve your grades, build your confidence and plan for the future you want. <BR> <BR> This fully revised fourth edition features: <BR> Chapters on all the core study skills - including research, critical thinking, academic writing, revision, team work and more <BR> E-learning coverage throughout <BR> Illustrations and a strong visual design - acting as memory joggers, reinforcing learning and making the book more accessible, fun and engaging <BR> Lots of new material including brand new chapters on student success and time management <BR> <BR> No matter whether you have just left school or college, whether you are a mature, part-time or international student, <EM> The Study Skills Handbook </EM> is your passport to success. <BR> + +Acknowledgements <BR> Introducing <SPAN style="FONT-STYLE: italic"> The Study Skills Handbook </SPAN> <BR> <STRONG> PART 1: MANAGING YOURSELF FOR STUDY <BR> </STRONG> 1. Success as a Student <BR> 2. Developing Your Skills <BR> 3. Successful Study: Intelligence, Strategy and Personalised Learning <BR> 4. The CREAM Strategy for Learning <BR> 5. Time Management as a Student <BR> <STRONG> PART II: ACADEMIC SKILLS <BR> </STRONG> 6. Core Research Skills: Reading, Note-Making and Managing Information <BR> 7. Critical Analytical Thinking <BR> 8. Memory <BR> 9. Confidence with Numbers <BR> <STRONG> PART III: PEOPLE SKILLS <BR> </STRONG> 10. Working with Others: Collaborative Study <BR> <STRONG> PART IV: TASK MANAGEMENT SKILLS <BR> </STRONG> 11. Writing at University Level <BR> 12. Developing Academic Writing <BR> 13. Research Projects, Case Studies and Dissertations <BR> 14. Revision and Exams <BR> <STRONG> PART V: DRAWING IT TOGETHER <BR> </STRONG> 15. Planning Your Next Move <BR> Appendix 1 Quick Multiplier <BR> Appendix 2 Online Research Tools <BR> Appendix 3 Further Resources on Managing and Studying as a Student <BR> Glossary of Terms Useful to Know in Higher Education <BR> Answers to Activities <BR> References <BR> Index + +Stella Cottrell is Pro-Vice-Chancellor for Learning, Teaching and Student Engagement at the University of East London, UK. This position sees a return to the University of East London for Stella where she previously spent ten years working in educational development. Prior to her current position, Stella was Director for Lifelong Learning at the University of Leeds, UK. + +1 \ No newline at end of file diff --git a/tests/unit/fixtures/record_packing_string.xml b/tests/unit/fixtures/record_packing_string.xml new file mode 100644 index 0000000..d9be4da --- /dev/null +++ b/tests/unit/fixtures/record_packing_string.xml @@ -0,0 +1,174 @@ + +1.13212dcstring<?xml version="1.0" encoding="UTF-8"?> +<srw_dc:dc xmlns:srw_dc="info:srw/schema/1/dc-schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:srw/schema/1/dc-schema http://www.loc.gov/standards/sru/resources/dc-schema.xsd"> + <title xmlns="http://purl.org/dc/elements/1.1/">1212 [sound recording] : Dezember 2012.</title> + <type xmlns="http://purl.org/dc/elements/1.1/">sound recording</type> + <type xmlns="http://purl.org/dc/elements/1.1/">Rock music. lcgft</type> + <type xmlns="http://purl.org/dc/elements/1.1/">Popular music. lcgft</type> + <publisher xmlns="http://purl.org/dc/elements/1.1/">[Berlin] : Musikexpress,</publisher> + <date xmlns="http://purl.org/dc/elements/1.1/">[2012]</date> + <language xmlns="http://purl.org/dc/elements/1.1/">eng</language> + <description xmlns="http://purl.org/dc/elements/1.1/">Various performers.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">"For promotion only!"</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Compact disc.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Issued with the Dec. 2012 issue of Musikexpress.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Elephant (Tame Impala) -- Partner in crime (Ecke Schönhauser) -- Peace of mind : Musikexpress edit (Fritz Kalkbrenner) -- I follow you (Melody's Echo Chamber) -- Dinosaur (Linnea Olsson) -- Long way to run (Bernhard Eder) -- Ich schäme mich (Hans Unstern) -- Den Rosenkavalier (HGich.T) -- Mach mich traurig (Die Liga der Gewöhnlichen Gentlemen) -- Wüde Hund (Neigungsgruppe Sex, Gewalt &amp; Gute Laune).</description> + <subject xmlns="http://purl.org/dc/elements/1.1/">Rock music--2011-2020.</subject> + <subject xmlns="http://purl.org/dc/elements/1.1/">Popular music--2011-2020.</subject> +</srw_dc:dc> +1dcstring<?xml version="1.0" encoding="UTF-8"?> +<srw_dc:dc xmlns:srw_dc="info:srw/schema/1/dc-schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:srw/schema/1/dc-schema http://www.loc.gov/standards/sru/resources/dc-schema.xsd"> + <title xmlns="http://purl.org/dc/elements/1.1/">3-D dinosaur adventure.</title> + <creator xmlns="http://purl.org/dc/elements/1.1/">Knowledge Adventure, Inc.</creator> + <creator xmlns="http://purl.org/dc/elements/1.1/">Copyright Collection (Library of Congress) DLC</creator> + <type xmlns="http://purl.org/dc/elements/1.1/">software, multimedia</type> + <type xmlns="http://purl.org/dc/elements/1.1/">Educational games.</type> + <type xmlns="http://purl.org/dc/elements/1.1/">Video games.</type> + <publisher xmlns="http://purl.org/dc/elements/1.1/">Glendale, CA : Knowledge Adventure,</publisher> + <date xmlns="http://purl.org/dc/elements/1.1/">c1995.</date> + <language xmlns="http://purl.org/dc/elements/1.1/">eng</language> + <description xmlns="http://purl.org/dc/elements/1.1/">Employs a dinosaur theme-park setting to introduce users to Triassic, Jurassic, and Cretaceous periods. Features hypertext dinosaur encyclopedia covering 150 million years of paleontology. Includes animated video simulations, three-dimensional dinosaur museum, narration, games, activities, and color illustrations.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">System requirements for PC: 486SX/25MHz processor or higher; 8MB RAM; Windows 3.1, 3.11, or 95; SVGA 256-color graphics adapter; hard drive with 5MB free space; double-speed CD-ROM drive; MPC-compatible sound card; mouse.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">System requirements for Macintosh: 68040 or Power PC processor; 8MB RAM; System 7.0 or higher; 256-color graphics capability; thirteen-inch color monitor or larger; hard drive with 4MB free space; double-speed CD-ROM drive.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Title from disc label.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Ages 5 to 10.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Not viewed.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Source used: Copyright catalog online.</description> + <subject xmlns="http://purl.org/dc/elements/1.1/">Dinosaurs--Juvenile software.</subject> + <identifier xmlns="http://purl.org/dc/elements/1.1/">URN:ISBN:1569972133</identifier> +</srw_dc:dc> +2dcstring<?xml version="1.0" encoding="UTF-8"?> +<srw_dc:dc xmlns:srw_dc="info:srw/schema/1/dc-schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:srw/schema/1/dc-schema http://www.loc.gov/standards/sru/resources/dc-schema.xsd"> + <title xmlns="http://purl.org/dc/elements/1.1/">30 Rock.</title> + <creator xmlns="http://purl.org/dc/elements/1.1/">Copyright Collection (Library of Congress) DLC</creator> + <type xmlns="http://purl.org/dc/elements/1.1/">moving image</type> + <type xmlns="http://purl.org/dc/elements/1.1/">Fiction television programs. lcgft</type> + <type xmlns="http://purl.org/dc/elements/1.1/">Situation comedies (Television programs) lcgft</type> + <publisher xmlns="http://purl.org/dc/elements/1.1/"/> + <date xmlns="http://purl.org/dc/elements/1.1/">2010-05-13.</date> + <language xmlns="http://purl.org/dc/elements/1.1/">eng</language> + <description xmlns="http://purl.org/dc/elements/1.1/">Episode no. 4021.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Sources used: videocassette container; Copyright catalog online; Copyright description.</description> +</srw_dc:dc> +3dcstring<?xml version="1.0" encoding="UTF-8"?> +<srw_dc:dc xmlns:srw_dc="info:srw/schema/1/dc-schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:srw/schema/1/dc-schema http://www.loc.gov/standards/sru/resources/dc-schema.xsd"> + <title xmlns="http://purl.org/dc/elements/1.1/">3D printing projects /</title> + <creator xmlns="http://purl.org/dc/elements/1.1/">Gerhard, Karyn, editor.</creator> + <type xmlns="http://purl.org/dc/elements/1.1/">text</type> + <type xmlns="http://purl.org/dc/elements/1.1/">Juvenile works. fast (OCoLC)fst01411637</type> + <language xmlns="http://purl.org/dc/elements/1.1/">eng</language> + <description xmlns="http://purl.org/dc/elements/1.1/">Provides instructions for creating models and objects using a 3D printer, from a pencil holder to a picture frame.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Includes index.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">3D printers -- 3D modeling -- Slicing -- After printing -- Fix it! -- Desk caddy -- Impossible box -- Dinosaur stamp -- Coat hook -- Photo frame -- Treasure box -- Phone stands -- Star lantern -- Plant pot -- Fridge magnet -- Race car -- Troll family -- Chess set -- Castle.</description> + <subject xmlns="http://purl.org/dc/elements/1.1/">Three-dimensional printing--Juvenile literature.</subject> + <subject xmlns="http://purl.org/dc/elements/1.1/">Handicraft--Juvenile literature.</subject> + <subject xmlns="http://purl.org/dc/elements/1.1/">Three-dimensional printing.</subject> + <subject xmlns="http://purl.org/dc/elements/1.1/">Handicraft.</subject> + <subject xmlns="http://purl.org/dc/elements/1.1/">Handicraft.</subject> + <subject xmlns="http://purl.org/dc/elements/1.1/">JUVENILE NONFICTION / Computers / Software.</subject> + <subject xmlns="http://purl.org/dc/elements/1.1/">JUVENILE NONFICTION / Technology / How Things Work-Are Made.</subject> + <subject xmlns="http://purl.org/dc/elements/1.1/">JUVENILE NONFICTION / Technology / Inventions.</subject> + <subject xmlns="http://purl.org/dc/elements/1.1/">Handicraft.</subject> + <subject xmlns="http://purl.org/dc/elements/1.1/">Three-dimensional printing.</subject> + <identifier xmlns="http://purl.org/dc/elements/1.1/">URN:ISBN:9781465464767</identifier> + <identifier xmlns="http://purl.org/dc/elements/1.1/">URN:ISBN:146546476X</identifier> +</srw_dc:dc> +4dcstring<?xml version="1.0" encoding="UTF-8"?> +<srw_dc:dc xmlns:srw_dc="info:srw/schema/1/dc-schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:srw/schema/1/dc-schema http://www.loc.gov/standards/sru/resources/dc-schema.xsd"> + <title xmlns="http://purl.org/dc/elements/1.1/">The '80s hit(s) back! [sound recording].</title> + <type xmlns="http://purl.org/dc/elements/1.1/">sound recording</type> + <type xmlns="http://purl.org/dc/elements/1.1/">Compact discs. lcsh</type> + <publisher xmlns="http://purl.org/dc/elements/1.1/">Universal City, Calif. : Hip-O Records,</publisher> + <date xmlns="http://purl.org/dc/elements/1.1/">p1996.</date> + <language xmlns="http://purl.org/dc/elements/1.1/">eng</language> + <description xmlns="http://purl.org/dc/elements/1.1/">Various performers.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Selections previously released 1983-1988.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Compact disc.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">She drives me crazy (Fine Young Cannibals) -- Walk the dinosaur (Was (Not Was)) -- You keep me hangin' on (Kim Wilde) -- The safety dance (Men Without Hats) -- Walking on sunshine (Katrina &amp; The Waves) -- One thing leads to another (The Fixx) -- Heaven is a place on earth (Belinda Carlisle) -- Everybody have fun tonight (Wang Chung) -- Cruel summer (Bananarama) -- Weird science (Oingo Boingo) -- Axel F (Harold Faltermeyer) -- The future's so bright, I gotta wear shades (Timbuk 3).</description> + <subject xmlns="http://purl.org/dc/elements/1.1/">Rock music--1981-1990.</subject> + <identifier xmlns="http://purl.org/dc/elements/1.1/">URN:ISBN:</identifier> +</srw_dc:dc> +5dcstring<?xml version="1.0" encoding="UTF-8"?> +<srw_dc:dc xmlns:srw_dc="info:srw/schema/1/dc-schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:srw/schema/1/dc-schema http://www.loc.gov/standards/sru/resources/dc-schema.xsd"> + <title xmlns="http://purl.org/dc/elements/1.1/">Abbott &amp; Costello cartoons.</title> + <creator xmlns="http://purl.org/dc/elements/1.1/">Copyright Collection (Library of Congress) DLC</creator> + <type xmlns="http://purl.org/dc/elements/1.1/">moving image</type> + <publisher xmlns="http://purl.org/dc/elements/1.1/">United States : [s.n.],</publisher> + <date xmlns="http://purl.org/dc/elements/1.1/">1967.</date> + <language xmlns="http://purl.org/dc/elements/1.1/">eng</language> + <description xmlns="http://purl.org/dc/elements/1.1/">Copyright: PUB 5May67; PA608-254.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Copyright notice on film: RKO General Inc., Jomar Prod. Inc., Hanna-Barbera Productions, Inc. ; 1967.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">On cassette with episodes: Frigid fugitive ; Invader raider ; Paddleboat pirate.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Number 12</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Animation.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Source used: copyright data sheet.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Copyright Collection.</description> +</srw_dc:dc> +6dcstring<?xml version="1.0" encoding="UTF-8"?> +<srw_dc:dc xmlns:srw_dc="info:srw/schema/1/dc-schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:srw/schema/1/dc-schema http://www.loc.gov/standards/sru/resources/dc-schema.xsd"> + <title xmlns="http://purl.org/dc/elements/1.1/">Abbott &amp; Costello cartoons.</title> + <creator xmlns="http://purl.org/dc/elements/1.1/">Copyright Collection (Library of Congress) DLC</creator> + <type xmlns="http://purl.org/dc/elements/1.1/">moving image</type> + <publisher xmlns="http://purl.org/dc/elements/1.1/">United States : [s.n.],</publisher> + <date xmlns="http://purl.org/dc/elements/1.1/">1967.</date> + <language xmlns="http://purl.org/dc/elements/1.1/">eng</language> + <description xmlns="http://purl.org/dc/elements/1.1/">Copyright: PUB 12May67; PA608-252.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Copyright notice on film: RKO General Inc., Jomar Prod. Inc., Hanna-Barbera Productions, Inc. ; 1967.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">On cassette with episodes: Invader raider ; Dinosaur dilemna ; Paddleboat pirate.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Number 12.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Animation.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Source used: copyright data sheet.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Copyright Collection.</description> +</srw_dc:dc> +7dcstring<?xml version="1.0" encoding="UTF-8"?> +<srw_dc:dc xmlns:srw_dc="info:srw/schema/1/dc-schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:srw/schema/1/dc-schema http://www.loc.gov/standards/sru/resources/dc-schema.xsd"> + <title xmlns="http://purl.org/dc/elements/1.1/">Abbott &amp; Costello cartoons.</title> + <creator xmlns="http://purl.org/dc/elements/1.1/">Copyright Collection (Library of Congress) DLC</creator> + <type xmlns="http://purl.org/dc/elements/1.1/">moving image</type> + <publisher xmlns="http://purl.org/dc/elements/1.1/">United States : [s.n.],</publisher> + <date xmlns="http://purl.org/dc/elements/1.1/">1967.</date> + <language xmlns="http://purl.org/dc/elements/1.1/">eng</language> + <description xmlns="http://purl.org/dc/elements/1.1/">Copyright: PUB 1Jun67; PA608-253.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Copyright notice on film: RKO General Inc., Jomar Prod. Inc., Hanna-Barbera Productions, Inc. ; 1967.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">On cassette with episodes: Frigid fugitive ; Dinosaur dilemna ; Paddleboat pirate.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Number 12.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Animation.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Source used: copyright data sheet.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Copyright Collection.</description> +</srw_dc:dc> +8dcstring<?xml version="1.0" encoding="UTF-8"?> +<srw_dc:dc xmlns:srw_dc="info:srw/schema/1/dc-schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:srw/schema/1/dc-schema http://www.loc.gov/standards/sru/resources/dc-schema.xsd"> + <title xmlns="http://purl.org/dc/elements/1.1/">Abbott &amp; Costello cartoons.</title> + <creator xmlns="http://purl.org/dc/elements/1.1/">Copyright Collection (Library of Congress) DLC</creator> + <type xmlns="http://purl.org/dc/elements/1.1/">moving image</type> + <publisher xmlns="http://purl.org/dc/elements/1.1/">United States : [s.n.],</publisher> + <date xmlns="http://purl.org/dc/elements/1.1/">1967</date> + <language xmlns="http://purl.org/dc/elements/1.1/">eng</language> + <description xmlns="http://purl.org/dc/elements/1.1/">Copyright: PUB 22Aug67; PA608-255.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Copyright notice on film: RKO General Inc., Jomar Prod. Inc., Hanna-Barbera Productions, Inc. ; 1967.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">On cassette with episodes: Frigid fugitive ; Invader raider ; Dinosaur dilemna.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Number 12.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Animation.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Source used: copyright data sheet.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Copyright Collection.</description> +</srw_dc:dc> +9dcstring<?xml version="1.0" encoding="UTF-8"?> +<srw_dc:dc xmlns:srw_dc="info:srw/schema/1/dc-schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:srw/schema/1/dc-schema http://www.loc.gov/standards/sru/resources/dc-schema.xsd"> + <title xmlns="http://purl.org/dc/elements/1.1/">Acorn, the nature nut.</title> + <creator xmlns="http://purl.org/dc/elements/1.1/">Copyright Collection (Library of Congress) DLC</creator> + <type xmlns="http://purl.org/dc/elements/1.1/">moving image</type> + <type xmlns="http://purl.org/dc/elements/1.1/">Nature Television series. migfg</type> + <type xmlns="http://purl.org/dc/elements/1.1/">Documentary Television series. migfg</type> + <type xmlns="http://purl.org/dc/elements/1.1/">Educational Television series. migfg</type> + <publisher xmlns="http://purl.org/dc/elements/1.1/"/> + <date xmlns="http://purl.org/dc/elements/1.1/">1995.</date> + <language xmlns="http://purl.org/dc/elements/1.1/">und</language> + <description xmlns="http://purl.org/dc/elements/1.1/">You might think the dinosaur craze has peaked, that this theme has been approached from just about every possible angle, until you take John Acorn's tour of the dinosaur world today.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Copyright: Great North Productions Inc. PUB 6Dec95; PA916-803.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Number 25.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Host: John Acorn.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Summary from Great North Productions Inc. WWW site, 4/19/1999.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Sources used: copyright data sheet; Television programming source books, series, 1998-99, p. S-664-665; Discovery Channel (Canada) WWW site, 4/19/1999.</description> + <description xmlns="http://purl.org/dc/elements/1.1/">Copyright Collection.</description> +</srw_dc:dc> +10111.1dinosaur110stringdc diff --git a/tests/unit/fixtures/record_packing_xml.xml b/tests/unit/fixtures/record_packing_xml.xml new file mode 100644 index 0000000..ca88ea5 --- /dev/null +++ b/tests/unit/fixtures/record_packing_xml.xml @@ -0,0 +1,154 @@ + +1.13212dcxml + 1212 [sound recording] : Dezember 2012. + sound recording + Rock music. lcgft + Popular music. lcgft + [Berlin] : Musikexpress, + [2012] + eng + Various performers. + "For promotion only!" + Compact disc. + Issued with the Dec. 2012 issue of Musikexpress. + Elephant (Tame Impala) -- Partner in crime (Ecke Schönhauser) -- Peace of mind : Musikexpress edit (Fritz Kalkbrenner) -- I follow you (Melody's Echo Chamber) -- Dinosaur (Linnea Olsson) -- Long way to run (Bernhard Eder) -- Ich schäme mich (Hans Unstern) -- Den Rosenkavalier (HGich.T) -- Mach mich traurig (Die Liga der Gewöhnlichen Gentlemen) -- Wüde Hund (Neigungsgruppe Sex, Gewalt & Gute Laune). + Rock music--2011-2020. + Popular music--2011-2020. +1dcxml + 3-D dinosaur adventure. + Knowledge Adventure, Inc. + Copyright Collection (Library of Congress) DLC + software, multimedia + Educational games. + Video games. + Glendale, CA : Knowledge Adventure, + c1995. + eng + Employs a dinosaur theme-park setting to introduce users to Triassic, Jurassic, and Cretaceous periods. Features hypertext dinosaur encyclopedia covering 150 million years of paleontology. Includes animated video simulations, three-dimensional dinosaur museum, narration, games, activities, and color illustrations. + System requirements for PC: 486SX/25MHz processor or higher; 8MB RAM; Windows 3.1, 3.11, or 95; SVGA 256-color graphics adapter; hard drive with 5MB free space; double-speed CD-ROM drive; MPC-compatible sound card; mouse. + System requirements for Macintosh: 68040 or Power PC processor; 8MB RAM; System 7.0 or higher; 256-color graphics capability; thirteen-inch color monitor or larger; hard drive with 4MB free space; double-speed CD-ROM drive. + Title from disc label. + Ages 5 to 10. + Not viewed. + Source used: Copyright catalog online. + Dinosaurs--Juvenile software. + URN:ISBN:1569972133 +2dcxml + 30 Rock. + Copyright Collection (Library of Congress) DLC + moving image + Fiction television programs. lcgft + Situation comedies (Television programs) lcgft + + 2010-05-13. + eng + Episode no. 4021. + Sources used: videocassette container; Copyright catalog online; Copyright description. +3dcxml + 3D printing projects / + Gerhard, Karyn, editor. + text + Juvenile works. fast (OCoLC)fst01411637 + eng + Provides instructions for creating models and objects using a 3D printer, from a pencil holder to a picture frame. + Includes index. + 3D printers -- 3D modeling -- Slicing -- After printing -- Fix it! -- Desk caddy -- Impossible box -- Dinosaur stamp -- Coat hook -- Photo frame -- Treasure box -- Phone stands -- Star lantern -- Plant pot -- Fridge magnet -- Race car -- Troll family -- Chess set -- Castle. + Three-dimensional printing--Juvenile literature. + Handicraft--Juvenile literature. + Three-dimensional printing. + Handicraft. + Handicraft. + JUVENILE NONFICTION / Computers / Software. + JUVENILE NONFICTION / Technology / How Things Work-Are Made. + JUVENILE NONFICTION / Technology / Inventions. + Handicraft. + Three-dimensional printing. + URN:ISBN:9781465464767 + URN:ISBN:146546476X +4dcxml + The '80s hit(s) back! [sound recording]. + sound recording + Compact discs. lcsh + Universal City, Calif. : Hip-O Records, + p1996. + eng + Various performers. + Selections previously released 1983-1988. + Compact disc. + She drives me crazy (Fine Young Cannibals) -- Walk the dinosaur (Was (Not Was)) -- You keep me hangin' on (Kim Wilde) -- The safety dance (Men Without Hats) -- Walking on sunshine (Katrina & The Waves) -- One thing leads to another (The Fixx) -- Heaven is a place on earth (Belinda Carlisle) -- Everybody have fun tonight (Wang Chung) -- Cruel summer (Bananarama) -- Weird science (Oingo Boingo) -- Axel F (Harold Faltermeyer) -- The future's so bright, I gotta wear shades (Timbuk 3). + Rock music--1981-1990. + URN:ISBN: +5dcxml + Abbott & Costello cartoons. + Copyright Collection (Library of Congress) DLC + moving image + United States : [s.n.], + 1967. + eng + Copyright: PUB 5May67; PA608-254. + Copyright notice on film: RKO General Inc., Jomar Prod. Inc., Hanna-Barbera Productions, Inc. ; 1967. + On cassette with episodes: Frigid fugitive ; Invader raider ; Paddleboat pirate. + Number 12 + Animation. + Source used: copyright data sheet. + Copyright Collection. +6dcxml + Abbott & Costello cartoons. + Copyright Collection (Library of Congress) DLC + moving image + United States : [s.n.], + 1967. + eng + Copyright: PUB 12May67; PA608-252. + Copyright notice on film: RKO General Inc., Jomar Prod. Inc., Hanna-Barbera Productions, Inc. ; 1967. + On cassette with episodes: Invader raider ; Dinosaur dilemna ; Paddleboat pirate. + Number 12. + Animation. + Source used: copyright data sheet. + Copyright Collection. +7dcxml + Abbott & Costello cartoons. + Copyright Collection (Library of Congress) DLC + moving image + United States : [s.n.], + 1967. + eng + Copyright: PUB 1Jun67; PA608-253. + Copyright notice on film: RKO General Inc., Jomar Prod. Inc., Hanna-Barbera Productions, Inc. ; 1967. + On cassette with episodes: Frigid fugitive ; Dinosaur dilemna ; Paddleboat pirate. + Number 12. + Animation. + Source used: copyright data sheet. + Copyright Collection. +8dcxml + Abbott & Costello cartoons. + Copyright Collection (Library of Congress) DLC + moving image + United States : [s.n.], + 1967 + eng + Copyright: PUB 22Aug67; PA608-255. + Copyright notice on film: RKO General Inc., Jomar Prod. Inc., Hanna-Barbera Productions, Inc. ; 1967. + On cassette with episodes: Frigid fugitive ; Invader raider ; Dinosaur dilemna. + Number 12. + Animation. + Source used: copyright data sheet. + Copyright Collection. +9dcxml + Acorn, the nature nut. + Copyright Collection (Library of Congress) DLC + moving image + Nature Television series. migfg + Documentary Television series. migfg + Educational Television series. migfg + + 1995. + und + You might think the dinosaur craze has peaked, that this theme has been approached from just about every possible angle, until you take John Acorn's tour of the dinosaur world today. + Copyright: Great North Productions Inc. PUB 6Dec95; PA916-803. + Number 25. + Host: John Acorn. + Summary from Great North Productions Inc. WWW site, 4/19/1999. + Sources used: copyright data sheet; Television programming source books, series, 1998-99, p. S-664-665; Discovery Channel (Canada) WWW site, 4/19/1999. + Copyright Collection. +10111.1dinosaur110xmldc diff --git a/tests/unit/fixtures/valid_marcxml.xml b/tests/unit/fixtures/valid_marcxml.xml new file mode 100644 index 0000000..ed6557e --- /dev/null +++ b/tests/unit/fixtures/valid_marcxml.xml @@ -0,0 +1,1034 @@ + +1.13212marcxmlxml + 01392cjm a2200325 a 4500 + 18919847 + 20160104074050.0 + sd fsngnnmmned + 151229s2012 gw mun| | eng + + 7 + cbc + orignew + 2 + ncip + 20 + y-soundrec + + + acquire + 2 shelf copies + policy default + + + qr12 2015-12-29 + + + 2015662372 + + + DLC + DLC + + + eng + ger + + + SDC 60883 + + + 1212 + [sound recording] : + Dezember 2012. + + + Title on container: + Nr. 1212 + + + [Berlin] : + Musikexpress, + [2012] + + + 1 sound disc : + digital ; + 4 3/4 in. + + + Various performers. + + + "For promotion only!" + + + Compact disc. + + + Issued with the Dec. 2012 issue of Musikexpress. + + + Elephant (Tame Impala) -- Partner in crime (Ecke Schönhauser) -- Peace of mind : Musikexpress edit (Fritz Kalkbrenner) -- I follow you (Melody's Echo Chamber) -- Dinosaur (Linnea Olsson) -- Long way to run (Bernhard Eder) -- Ich schäme mich (Hans Unstern) -- Den Rosenkavalier (HGich.T) -- Mach mich traurig (Die Liga der Gewöhnlichen Gentlemen) -- Wüde Hund (Neigungsgruppe Sex, Gewalt & Gute Laune). + + + Rock music + 2011-2020. + + + Popular music + 2011-2020. + + + Rock music. + lcgft + + + Popular music. + lcgft + + + Musikexpress. + +1marcxmlxml + 02256cmm a22004337a 4500 + 5003946 + 20110222145848.0 + co cga|||||||| + 970701s1995 cau cq m eng + + 7 + cbc + orignew + u + ncip + 19 + y-movingim + + + vb25 07-01-97; vb22 to jd00/lb00 07-07-97; jd99 (subj) 07-09-97; lb09 07-11-97; + vb30 2002-12-19 added 130 (rev vb02 2002-12-19); qm14 2010-12-17 + + + 97802583 + + + PA0000831620 + U.S. Copyright Office + + + 1569972133 + + + 9781569972137 + + + (DLC) 97802583 + + + DLC + DLC + DLC + + + HAA 0029 + + + 567.9 + 12 + + + Dinosaur adventure 3-D + + + 3-D dinosaur adventure. + + + Three-dimensional dinosaur adventure + + + Computer data and program. + + + Glendale, CA : + Knowledge Adventure, + c1995. + + + 1 computer laser optical disc ; + 4 3/4 in. + + 1 user's guide + 1 quick reference guide + 2 pairs of three-dimensional eyeglasses. + + + System requirements for PC: 486SX/25MHz processor or higher; 8MB RAM; Windows 3.1, 3.11, or 95; SVGA 256-color graphics adapter; hard drive with 5MB free space; double-speed CD-ROM drive; MPC-compatible sound card; mouse. + + + System requirements for Macintosh: 68040 or Power PC processor; 8MB RAM; System 7.0 or higher; 256-color graphics capability; thirteen-inch color monitor or larger; hard drive with 4MB free space; double-speed CD-ROM drive. + + + Title from disc label. + + + Ages 5 to 10. + + + Employs a dinosaur theme-park setting to introduce users to Triassic, Jurassic, and Cretaceous periods. Features hypertext dinosaur encyclopedia covering 150 million years of paleontology. Includes animated video simulations, three-dimensional dinosaur museum, narration, games, activities, and color illustrations. + + + Not viewed. + + + Source used: Copyright catalog online. + + + Dinosaurs + Juvenile software. + + + Educational games. + + + Video games. + + + Knowledge Adventure, Inc. + + + Copyright Collection (Library of Congress) + DLC + + + PC + Windows 3.1 + + + Macintosh + System 7.0 + +2marcxmlxml + 01045cgm a22002773a 4500 + 16429180 + 20120118181740.0 + vffcjaho| + 100823s2010 xxu060 mleng + + 0 + cbc + orignew + u + ncip + 20 + y-movingim + + + qm12 2010-08-23 + + + 2010608899 + + + PA0001684303 + U.S. Copyright Office + + + DLC + DLC + amim + DLC + + + VBU 4599 (viewing copy) + + + 30 Rock. + Emmanuelle goes to Dinosaur Land. + + + Emmanuelle goes to Dinosaur Land + + + Thirty Rock. + Emmanuelle goes to Dinosaur Land + + + United States. + + + 2010-05-13. + + + viewing copy. + 1 videocassette of 1 (Betacam SP) (60 min.) : + sd., col. ; + 1/2 in. + + + Episode no. 4021. + + + Sources used: videocassette container; Copyright catalog online; Copyright description. + + + Fiction television programs. + lcgft + + + Situation comedies (Television programs) + lcgft + + + Copyright Collection (Library of Congress) + DLC + +3marcxmlxml + 02234cam a22004937i 4500 + 20352024 + 20180313131201.0 + 180209t20172017nyua j 001 0 eng d + + 7 + cbc + copycat + 2 + ncip + 20 + y-gencatlg + + + acquire + 1 shelf copy + policy default + + + xn01 2018-02-09 z-processor to USASH + rk07 2018-03-02 to BCCD + + + 2017285681 + + + 9781465464767 + (softcover) + + + 146546476X + (softcover) + + + (OCoLC)on1004775912 + + + PNX + eng + PNX + rda + OCLCQ + WIMVL + OCLCF + OCLCO + FBR + IUK + NYP + MDK + EHH + T3L + DLC + + + lccopycat + + + TS171.95 + .A17 2017 + + + 621.9/88 + 23 + + + 3D printing projects / + US editor, Karyn Gerhard. + + + Three-dimensional printing projects + + + First American edition. + + + New York, New York : + DK Publishing, + [2017] + + + ©2017 + + + 96 pages : + color illustrations ; + 29 cm + + + text + txt + rdacontent + + + still image + sti + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + Provides instructions for creating models and objects using a 3D printer, from a pencil holder to a picture frame. + + + Includes index. + + + 3D printers -- 3D modeling -- Slicing -- After printing -- Fix it! -- Desk caddy -- Impossible box -- Dinosaur stamp -- Coat hook -- Photo frame -- Treasure box -- Phone stands -- Star lantern -- Plant pot -- Fridge magnet -- Race car -- Troll family -- Chess set -- Castle. + + + Three-dimensional printing + Juvenile literature. + + + Handicraft + Juvenile literature. + + + Three-dimensional printing. + + + Handicraft. + + + Handicraft. + + + JUVENILE NONFICTION / Computers / Software. + bisacsh + + + JUVENILE NONFICTION / Technology / How Things Work-Are Made. + bisacsh + + + JUVENILE NONFICTION / Technology / Inventions. + bisacsh + + + Handicraft. + fast + (OCoLC)fst00950959 + + + Three-dimensional printing. + fast + (OCoLC)fst01748862 + + + Juvenile works. + fast + (OCoLC)fst01411637 + + + Gerhard, Karyn, + editor. + +4marcxmlxml + 01718cjm a22003971a 4500 + 13463061 + 20051217130827.0 + sd fsngnnmmned + 040120r19961983caurcn eng d + + 076744000422 + + + (DLC) 2004567544 + + + KFW + KFW + IEP + OCLCQ + DLC + + + $17.98 + + + 076744000422 + + + HIPD 40004 + Hip-O Records + + + 40004-2 + Hip-O Records + + + (OCoLC)ocm35640234 + + + HIPD-40004 + Hip-O Records + + + 2004567544 + + + lcderive + + + SDA 85496 + + + The '80s hit(s) back! + [sound recording]. + + + Eighty's hit(s) back! + + + Universal City, Calif. : + Hip-O Records, + p1996. + + + 1 sound disc : + digital ; + 4 3/4 in. + + + Various performers. + + + Selections previously released 1983-1988. + + + Compact disc. + + + She drives me crazy (Fine Young Cannibals) -- Walk the dinosaur (Was (Not Was)) -- You keep me hangin' on (Kim Wilde) -- The safety dance (Men Without Hats) -- Walking on sunshine (Katrina & The Waves) -- One thing leads to another (The Fixx) -- Heaven is a place on earth (Belinda Carlisle) -- Everybody have fun tonight (Wang Chung) -- Cruel summer (Bananarama) -- Weird science (Oingo Boingo) -- Axel F (Harold Faltermeyer) -- The future's so bright, I gotta wear shades (Timbuk 3). + + + Rock music + 1981-1990. + + + Compact discs. + lcsh + + + 7 + cbc + copycat + 3 + ncip + 20 + y-genmusic + + + acquire + 2 copies + policy default + + + muzerec + + + vn76 2004-01-20 to MBRS/RS + vn76 2004-01-20 copy 2 to MBRS/RS + + + OCLC + srreplace 2005-08 + +5marcxmlxml + 01461ngm a22003375a 4500 + 11624471 + 00000000000000.0 + 930921s1967 xxu vaeng + + (DLC) 93513624 + + + 0 + ibc + orignew + u + ncip + 19 + y-movingim + + + 93513624 + + v| |||||| + + PA608-254 + U.S. Copyright Office + + + DLC + DLC + amim + + + VBK 2042 (viewing copy) + + + Abbott & Costello cartoons. + Dinosaur Dilemna / + a Hanna-Barbera Production in association with RKO Pictures Company-Jomar Productions ; directed and produced by Joseph Barbera and William Hanna. + + + United States : + [s.n.], + 1967. + + + 1 videocassette of 1 : + sd., col. ; + 3/4 in. viewing copy. + + + Copyright: PUB 5May67; PA608-254. + + + Copyright notice on film: RKO General Inc., Jomar Prod. Inc., Hanna-Barbera Productions, Inc. ; 1967. + + + On cassette with episodes: Frigid fugitive ; Invader raider ; Paddleboat pirate. + + + Number 12 + + + Animation. + + + Source used: copyright data sheet. + + + Received: 4/27/1993; + viewing copy; + copyright deposit--RNR; + Copyright Collection. + + + Copyright Collection (Library of Congress) + DLC + + + Dinosaur dilemna. + + + Abbott and Costello cartoons. + Dinosaur dilemna. + + + TE01 + + + qxp + + + c-MP&TV + VBK 2042 (viewing copy) + MUMS VM File + +6marcxmlxml + 01461ngm a22003375a 4500 + 11624468 + 00000000000000.0 + 930921s1967 xxu vaeng + + (DLC) 93513621 + + + 0 + ibc + orignew + u + ncip + 19 + y-movingim + + + 93513621 + + v| |||||| + + PA608-252 + U.S. Copyright Office + + + DLC + DLC + amim + + + VBK 2042 (viewing copy) + + + Abbott & Costello cartoons. + Frigid fugitive / + a Hanna-Barbera Production in association with RKO Pictures Company-Jomar Productions ; directed and produced by Joseph Barbera and William Hanna. + + + United States : + [s.n.], + 1967. + + + 1 videocassette of 1 : + sd., col. ; + 3/4 in. viewing copy. + + + Copyright: PUB 12May67; PA608-252. + + + Copyright notice on film: RKO General Inc., Jomar Prod. Inc., Hanna-Barbera Productions, Inc. ; 1967. + + + On cassette with episodes: Invader raider ; Dinosaur dilemna ; Paddleboat pirate. + + + Number 12. + + + Animation. + + + Source used: copyright data sheet. + + + Received: 4/27/1993; + viewing copy; + copyright deposit--RNR; + Copyright Collection. + + + Copyright Collection (Library of Congress) + DLC + + + Frigid fugitive. + + + Abbott and Costello cartoons. + Frigid fugitive. + + + TE01 + + + qxp + + + c-MP&TV + VBK 2042 (viewing copy) + MUMS VM File + +7marcxmlxml + 01458ngm a22003375a 4500 + 11624469 + 00000000000000.0 + 930921s1967 xxu vaeng + + (DLC) 93513622 + + + 0 + ibc + orignew + u + ncip + 19 + y-movingim + + + 93513622 + + v| |||||| + + PA608-253 + U.S. Copyright Office + + + DLC + DLC + amim + + + VBK 2042 (viewing copy) + + + Abbott & Costello cartoons. + Invader raider / + a Hanna-Barbera Production in association with RKO Pictures Company-Jomar Productions ; directed and produced by Joseph Barbera and William Hanna. + + + United States : + [s.n.], + 1967. + + + 1 videocassette of 1 : + sd., col. ; + 3/4 in. viewing copy. + + + Copyright: PUB 1Jun67; PA608-253. + + + Copyright notice on film: RKO General Inc., Jomar Prod. Inc., Hanna-Barbera Productions, Inc. ; 1967. + + + On cassette with episodes: Frigid fugitive ; Dinosaur dilemna ; Paddleboat pirate. + + + Number 12. + + + Animation. + + + Source used: copyright data sheet. + + + Received: 4/27/1993; + viewing copy; + copyright deposit--RNR; + Copyright Collection. + + + Copyright Collection (Library of Congress) + DLC + + + Invader raider. + + + Abbott and Costello cartoons. + Invader raider. + + + TE01 + + + qxp + + + c-MP&TV + VBK 2042 (viewing copy) + MUMS VM File + +8marcxmlxml + 01463ngm a22003375a 4500 + 11624473 + 00000000000000.0 + 930921s1967 xxu vaeng + + (DLC) 93513626 + + + 0 + ibc + orignew + u + ncip + 19 + y-movingim + + + 93513626 + + v| |||||| + + PA608-255 + U.S. Copyright Office + + + DLC + DLC + amim + + + VBK 2042 (viewing copy) + + + Abbott & Costello cartoons. + Paddleboat pirate / + a Hanna-Barbera Production in association with RKO Pictures Company-Jomar Productions ; directed and produced by Joseph Barbera and William Hanna. + + + United States : + [s.n.], + 1967 + + + 1 videocassette of 1 : + sd., col. ; + 3/4 in. viewing copy. + + + Copyright: PUB 22Aug67; PA608-255. + + + Copyright notice on film: RKO General Inc., Jomar Prod. Inc., Hanna-Barbera Productions, Inc. ; 1967. + + + On cassette with episodes: Frigid fugitive ; Invader raider ; Dinosaur dilemna. + + + Number 12. + + + Animation. + + + Source used: copyright data sheet. + + + Received: 4/27/1993; + viewing copy; + copyright deposit--RNR; + Copyright Collection. + + + Copyright Collection (Library of Congress) + DLC + + + Paddleboat pirate. + + + Abbott and Costello cartoons. + Paddleboat pirate + + + TE01 + + + qxp + + + c-MP&TV + VBK 2042 (viewing copy) + MUMS VM File + +9marcxmlxml + 01780ngm a22003495a 4500 + 11731470 + 00000000000000.0 + 990512s1995 xx vlund + + (DLC) 99405798 + + + 0 + ibc + orignew + u + ncip + 19 + y-movingim + + + 99405798 + + v| |||||| + + PA916-803 + U.S. Copyright Office + + + DLC + DLC + amim + + + VAG 3383 (viewing copy) + + + Acorn, the nature nut. + Giant dumbos of the past / + a co-production between Great North Productions Inc. [and] Evergreen Program Developments ; produced in association with Discovery Channel Canada ; directed by Brian Dooley. + + + Giant dumbos of the past + + + 1995. + + + 1 videocassette of 1 (VHS) : + sd., col. ; + 1/2 in. viewing copy. + + + Copyright: Great North Productions Inc. PUB 6Dec95; PA916-803. + + + Number 25. + + + Host: John Acorn. + + + You might think the dinosaur craze has peaked, that this theme has been approached from just about every possible angle, until you take John Acorn's tour of the dinosaur world today. + + + Summary from Great North Productions Inc. WWW site, 4/19/1999. + + + Sources used: copyright data sheet; Television programming source books, series, 1998-99, p. S-664-665; Discovery Channel (Canada) WWW site, 4/19/1999. + + + Received: 2/12/1999; + viewing copy; + copyright deposit---no agreement; + Copyright Collection. + + + Nature + Television series. + migfg + + + Documentary + Television series. + migfg + + + Educational + Television series. + migfg + + + Copyright Collection (Library of Congress) + DLC + + + TE01 + + + c-MP&TV + VAG 3383 (viewing copy) + MUMS VM File + +10111.1dinosaur110xmlmarcxml From e0ec3812f5d50fa2e1900767f1f2122732ca865b Mon Sep 17 00:00:00 2001 From: Ross Singer Date: Thu, 2 Aug 2018 13:13:37 -0400 Subject: [PATCH 3/7] Add travis yaml file --- .travis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..f14a1c2 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,9 @@ +language: php +php: + - '5.5' + - '5.6' + - '7.0' + - '7.1' +install: + - composer install + - composer dumpautoload \ No newline at end of file From 25c006456d8d512a22e1b0775fd662092c7b5ddb Mon Sep 17 00:00:00 2001 From: Ross Singer Date: Thu, 2 Aug 2018 13:16:08 -0400 Subject: [PATCH 4/7] Stub README --- README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..8cb697e --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +SRU Client for PHP +================== \ No newline at end of file From c49ab19e345e5ae4562ec784973618ced9e0d58e Mon Sep 17 00:00:00 2001 From: Ross Singer Date: Thu, 2 Aug 2018 13:32:35 -0400 Subject: [PATCH 5/7] Readme/test stuff --- README.md | 122 +++++++++++++++++++++++++++++++++++++++++++- phpunit.xml | 13 +++++ tests/bootstrap.php | 2 + 3 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 phpunit.xml create mode 100644 tests/bootstrap.php diff --git a/README.md b/README.md index 8cb697e..6f1a2f8 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,122 @@ SRU Client for PHP -================== \ No newline at end of file +================== + +A PHP Client library for [SRU](http://www.loc.gov/standards/sru/) servers. + +Usage +----- + +``` +$client = new \SRU\Client('http://lx2.loc.gov:210/LCDB', ['recordSchema' => 'marcxml']); + +$response = $client->searchRetrieve('dinosaur', ['maximumRecords' => 5]); + +$response->numberOfRecords(); +> 3212 + +$record = $response->getRecords()[0]; +$record->schema(); +> 'marcxml' + +$record->position(); +> 1 +$response->nextPosition(); +> 11 + +get_class($record->getData()); +> DOMElement // <-- MARC record structure here + +echo $record->getData(true); // Returns a string representation of the data + + + 01392cjm a2200325 a 4500 + 18919847 + 20160104074050.0 + sd fsngnnmmned + 151229s2012 gw mun| | eng + + 7 + cbc + orignew + 2 + ncip + 20 + y-soundrec + + + acquire + 2 shelf copies + policy default + + + qr12 2015-12-29 + + + 2015662372 + + + DLC + DLC + + + eng + ger + + + SDC 60883 + + + 1212 + [sound recording] : + Dezember 2012. + + + Title on container: + Nr. 1212 + + + [Berlin] : + Musikexpress, + [2012] + + + 1 sound disc : + digital ; + 4 3/4 in. + + + Various performers. + + + "For promotion only!" + + + Compact disc. + + + Issued with the Dec. 2012 issue of Musikexpress. + + + Elephant (Tame Impala) -- Partner in crime (Ecke Schönhauser) -- Peace of mind : Musikexpress edit (Fritz Kalkbrenner) -- I follow you (Melody's Echo Chamber) -- Dinosaur (Linnea Olsson) -- Long way to run (Bernhard Eder) -- Ich schäme mich (Hans Unstern) -- Den Rosenkavalier (HGich.T) -- Mach mich traurig (Die Liga der Gewöhnlichen Gentlemen) -- Wüde Hund (Neigungsgruppe Sex, Gewalt & Gute Laune). + + + Rock music + 2011-2020. + + + Popular music + 2011-2020. + + + Rock music. + lcgft + + + Popular music. + lcgft + + + Musikexpress. + + +``` diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..31b5b53 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,13 @@ + + + + tests/unit + + + + + ./src + + + \ No newline at end of file diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..18292fd --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,2 @@ + Date: Thu, 2 Aug 2018 13:37:54 -0400 Subject: [PATCH 6/7] Add build status to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 6f1a2f8..c737aef 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ SRU Client for PHP A PHP Client library for [SRU](http://www.loc.gov/standards/sru/) servers. +[![Build Status](https://travis-ci.org/talis/SRUClient-php.svg?branch=master)](https://travis-ci.org/talis/SRUClient-php) + Usage ----- From 6c37cc6c41174df80b9d0e48e6c3b233a197ef35 Mon Sep 17 00:00:00 2001 From: Ross Singer Date: Thu, 2 Aug 2018 15:28:09 -0400 Subject: [PATCH 7/7] array to [] --- src/SRU/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SRU/Client.php b/src/SRU/Client.php index 332ba71..540e422 100644 --- a/src/SRU/Client.php +++ b/src/SRU/Client.php @@ -102,7 +102,7 @@ public function search($query, $options = [], $raw = false) * @param bool $raw If true, returns the response as a string * @return SearchRetrieveResponse|string */ - public function searchRetrieve($query, $options = array(), $raw = false) + public function searchRetrieve($query, $options = [], $raw = false) { $defaultOptions = [ 'version' => $this->getDefaultSRUVersion(),