Esempio n. 1
0
 protected function getNthrecord($n)
 {
     $response = new XmlImporter('tests/data/sru-alma.xml');
     $collection = $response->getCollection();
     $records = $collection->records;
     foreach (range(1, $n) as $i) {
         $records->next();
     }
     return $records->current();
 }
Esempio n. 2
0
 public function fromString($data)
 {
     $isXml = substr($data, 0, 1) == '<';
     if ($isXml) {
         $importer = new XmlImporter($data);
         return $importer->getCollection();
     } else {
         $parser = $this->factory->make('File_MARC', $data, File_MARC::SOURCE_STRING);
         return new Collection($parser);
     }
 }
Esempio n. 3
0
 public function getCollection()
 {
     $isXml = substr($this->data, 0, 1) == '<';
     if ($isXml) {
         $importer = new XmlImporter($this->data);
         return $importer->getCollection();
     } else {
         $c = new Collection();
         $c->parse($this->data, false);
         return $c;
     }
 }
Esempio n. 4
0
 public static function fromOaiPmhResponse($data)
 {
     $importer = new XmlImporter($data);
     return $importer->getCollection();
 }
Esempio n. 5
0
 public function testBibsysSample()
 {
     $response = new XmlImporter('tests/data/oaipmh-bibsys.xml');
     $this->assertCount(89, $response->getRecords());
 }
Esempio n. 6
0
 public function testEmptySet()
 {
     $response = new XmlImporter('<records></records>');
     $this->assertCount(0, $response->getCollection()->records);
 }
Esempio n. 7
0
 public function testAlmaSample()
 {
     $response = new XmlImporter('tests/data/sru-alma.xml');
     $this->assertCount(3, $response->getRecords());
 }