If the data source declares a default namespace (e.g., <OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/">), this must be assigned a non-empty prefix using registerXPathNamespace() in order for it to be accessible through the xpath() function.

For discussion, see for instance: http://www.perlmonks.org/?node_id=530519.

The attached patch allows setting a prefix to solve this issue.

CommentFileSizeAuthor
oaipmh.inc_.patch1.27 KBwoutgg

Comments

woutgg created an issue. See original summary.

seanb’s picture

Some feedback below. Please check out the documentation on how to contribute patches https://www.drupal.org/node/707484. This saves people time applying and improving patches. Thanks for taking the time to contribute!

  1. +++ oaipmh.inc	2017-03-02 15:04:24.000000000 +0100
    @@ -35,6 +35,25 @@
    +   * See: https://secure.php.net/manual/en/simplexmlelement.xpath.php#115957
    +   * and http://www.perlmonks.org/?node_id=530519.
    

    Use @see for links related to documentation. https://www.drupal.org/docs/develop/coding-standards/api-documentation-a...

  2. +++ oaipmh.inc	2017-03-02 15:04:24.000000000 +0100
    @@ -35,6 +35,25 @@
    +  public function getDefaultNamespacePrefix() {
    +    return $this->defaultNamespacePrefix;
    +  }
    +  public function setDefaultNamespacePrefix($pfx) {
    +    $this->defaultNamespacePrefix = $pfx;
    +  }
    

    These should be somewhere after the constructor and have some documentation.

  3. +++ oaipmh.inc	2017-03-02 15:04:24.000000000 +0100
    @@ -127,8 +146,12 @@
    +
    

    Unrelated change.

  • seanB committed dcd2fbe on 7.x-1.x authored by woutgg
    Issue #2857328 by woutgg: Cannot access elements in default namespace...
seanb’s picture

Status: Active » Fixed

Fixed the minor issues and committed. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.