/**
  * 
  * 
  * @param string $ps_source
  * @param array $pa_options
  * @return bool
  */
 public function read($ps_source, $pa_options = null)
 {
     parent::read($ps_source, $pa_options);
     try {
         $this->opo_xml = DOMDocument::load($ps_source);
         $this->opo_xpath = new DOMXPath($this->opo_xml);
     } catch (Exception $e) {
         return null;
     }
     $this->opo_xpath->registerNamespace($this->ops_xml_namespace_prefix, $this->ops_xml_namespace);
     // get metadata
     $this->opo_metadata = $this->opo_xpath->query($this->ops_metadata_xpath);
     $vn_index = 0;
     $this->opa_metadata = array();
     foreach ($this->opo_metadata as $o_field) {
         $o_name = $o_field->attributes->getNamedItem('NAME');
         // Normalize field names by replacing any run of characters that is not a letter, number,
         // underscore, -, #, ?, :, % or & with a single underscore.
         $vs_field_name = preg_replace("![^A-Za-z0-9_\\-\\:\\#\\?\\%\\&]+!", "_", (string) $o_name->nodeValue);
         $this->opa_metadata[$vn_index] = $vs_field_name;
         $vn_index++;
     }
     // get rows
     $this->opo_handle = $this->opo_xpath->query($this->ops_xpath);
     $this->opn_current_row = 0;
     return $this->opo_handle ? true : false;
 }
Ejemplo n.º 2
0
 /**
  * 
  * 
  * @param string $ps_source A comma or semicolon separated list of WorldCat ids
  * @param array $pa_options
  * @return bool
  */
 public function read($ps_source, $pa_options = null)
 {
     parent::read($ps_source, $pa_options);
     // source is a comma or semicolon separated list of WorldCat ids
     $va_ids = preg_split("![,;]+!", $ps_source);
     if (!is_array($va_ids) || !sizeof($va_ids)) {
         return false;
     }
     if ($vs_api_key = caGetOption('APIKey', $pa_options, null)) {
         $this->ops_api_key = $vs_api_key;
     }
     $this->opa_row_ids = $va_ids;
     $this->opn_current_row = 0;
     return true;
 }
Ejemplo n.º 3
0
 /**
  * 
  * 
  * @param string $ps_source A comma or semicolon separated list of WorldCat ids
  * @param array $pa_options
  * @return bool
  */
 public function read($ps_source, $pa_options = null)
 {
     parent::read($ps_source, $pa_options);
     // source is a comma or semicolon separated list of ULAN ids
     $va_ids = preg_split("![,;]+!", $ps_source);
     if (!is_array($va_ids) || !sizeof($va_ids)) {
         return false;
     }
     $this->opa_row_ids = $va_ids;
     $this->opn_current_row = 0;
     return true;
 }