예제 #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();
 }
예제 #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);
     }
 }
예제 #3
0
파일: Importer.php 프로젝트: cKlee/php-marc
 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;
     }
 }
예제 #4
0
 public static function fromOaiPmhResponse($data)
 {
     $importer = new XmlImporter($data);
     return $importer->getCollection();
 }
예제 #5
0
 public function testBibsysSample()
 {
     $response = new XmlImporter('tests/data/oaipmh-bibsys.xml');
     $this->assertCount(89, $response->getRecords());
 }
예제 #6
0
 public function testEmptySet()
 {
     $response = new XmlImporter('<records></records>');
     $this->assertCount(0, $response->getCollection()->records);
 }
예제 #7
0
 public function testAlmaSample()
 {
     $response = new XmlImporter('tests/data/sru-alma.xml');
     $this->assertCount(3, $response->getRecords());
 }