private function parseRecordData($data)
 {
     $dom = new QuiteSimpleXMLElement('<?xml version="1.0"?>
         <marc:record xmlns:marc="info:lc/xmlns/marcxchange-v1" format="MARC21" type="Holdings">
             ' . $data . '
         </marc:record>');
     $dom->registerXPathNamespaces(array('marc' => 'http://www.loc.gov/MARC21/slim'));
     return new HoldingsRecord($dom);
 }
예제 #2
0
 /**
  * Parses an XML-formatted NCIP request or response
  * Throws Danmichaelo\QuiteSimpleXMLElement\InvalidXMLException on failure
  *
  * @param  string   $xml
  * @return QuiteSimpleXMLElement
  */
 public function parseXml($xml)
 {
     if (is_null($xml)) {
         return null;
     }
     $xml = new QuiteSimpleXMLElement($xml);
     $xml->registerXPathNamespaces($this->namespaces);
     return $xml;
 }
예제 #3
0
    public function testBasicCase()
    {
        $r = new QuiteSimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?>
			<record xmlns="http://www.openarchives.org/OAI/2.0/">
				<header>
					<identifier>oai:bibsys.no:biblio:113889372</identifier>
					<datestamp>2013-02-04T13:54:53Z</datestamp>
				</header>
				<metadata>
					The record
				</metadata>
			</record>');
        $r->registerXPathNamespaces(array('oai' => 'http://www.openarchives.org/OAI/2.0/'));
        $res = new Record($r);
        $this->assertEquals('oai:bibsys.no:biblio:113889372', $res->identifier);
        $this->assertEquals('2013-02-04T13:54:53Z', $res->datestamp);
        $this->assertEquals('The record', $res->data->text());
    }