Пример #1
0
 /**
  * Parse an XML string, register the namespaces it uses, and return the
  * result.
  *
  * @param string $content
  *
  * @return SimpleXMLElement
  */
 private function parseXml($content)
 {
     $xml = new SimpleXMLElement($content);
     $ns = new Namespaces();
     $ns->registerNamespaces($xml);
     return $xml;
 }
Пример #2
0
 /**
  * Fetch the SWORD statement.
  *
  * @todo complete this stub
  *
  * @param Deposit $deposit
  *
  * @return \SimpleXMLElement
  */
 public function statement(Deposit $deposit)
 {
     $receipt = $this->receipt($deposit);
     $statementUrl = $receipt->xpath('atom:link[@rel="http://purl.org/net/sword/terms/statement"]/@href')[0];
     $client = $this->getClient();
     $statementRequest = $client->createRequest('GET', $statementUrl);
     $statementResponse = $client->send($statementRequest);
     $statementXml = new \SimpleXMLElement($statementResponse->getBody());
     $this->namespaces->registerNamespaces($statementXml);
     return $statementXml;
 }
 /**
  * @return SimpleXMLElement
  * @param Client $client
  */
 protected function getXml()
 {
     $xml = new SimpleXMLElement($this->client->getResponse()->getContent());
     $this->ns->registerNamespaces($xml);
     return $xml;
 }
    private function getDepositXml()
    {
        $str = <<<'ENDXML'
<entry 
    xmlns="http://www.w3.org/2005/Atom" 
    xmlns:dcterms="http://purl.org/dc/terms/"
    xmlns:pkp="http://pkp.sfu.ca/SWORD">
    <email>foo@example.com</email>
    <title>Test Data Journal of Testing</title>
    <pkp:journal_url>http://tdjt.example.com</pkp:journal_url>
    <pkp:publisherName>Publisher of Stuff</pkp:publisherName>
    <pkp:publisherUrl>http://publisher.example.com</pkp:publisherUrl>
    <pkp:issn>1234-1234</pkp:issn>
    <id>urn:uuid:28FF5B33-D3C4-440C-B87A-16D402D10D93</id>
    <updated>2016-04-22T12:35:48Z</updated>
    <pkp:content size="123" volume="2" issue="4" pubdate="2016-04-22" 
		checksumType="SHA-1"
        checksumValue="d46c034ef54c36237b89d456968965432830a603">http://example.com/deposit/foo.zip</pkp:content>
    <pkp:license>
        <pkp:publishingMode>Open</pkp:publishingMode>
        <pkp:openAccessPolicy>OA GOOD</pkp:openAccessPolicy>
        <pkp:licenseUrl>http://example.com/license</pkp:licenseUrl>
        <pkp:copyrightNotice>Copyright ME</pkp:copyrightNotice>
        <pkp:copyrightBasis>ME</pkp:copyrightBasis>
        <pkp:copyrightHolder>MYSELF</pkp:copyrightHolder>
    </pkp:license>
</entry>
ENDXML;
        $xml = new SimpleXmlElement($str);
        $ns = new Namespaces();
        $ns->registerNamespaces($xml);
        return $xml;
    }