Ignore:
Timestamp:
2009-04-06T13:18:45+12:00 (15 years ago)
Author:
kjdon
Message:

added is_valid_element to metaformat, which checks elementSet for the element name. metaformat subclass constructors must set up elementSet. Currently they do this in the code. would be good if it could read in from a file eventually, maybe?? When metaformat is outputting the m,etadata, it checks whether the element is valid before outputting. otherwise it will invalidate the response as it won't conform to the schema. also, changed where we lowercased the entire name to lowercasing only the first letter - some qdc fields have an internal upper case letter.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/runtime-src/src/oaiservr/metaformat.cpp

    r18884 r18895  
    6969    if (metaItem == this->formatPrefix()) {
    7070      metaItem = substr(last+1, here->first.end()); // Get the rest of the metadata tag (it's name) but without the '.'
    71       lc(metaItem); // Convert it to lowercase for putting in the xml tags
    72 
     71      lc(metaItem.begin(),metaItem.begin()+1); // We want lowercase, but some of the fields in qualified dublin core have internal upper case, eg instructionalMethod. So we assume that lowercasing the first letter is enough
    7372      if (doOutput) {
    74     this->output_item(output, utf8convert, headerDone, metaItem, here->second.values);
     73    if (this->is_valid_element(metaItem)) {
     74     
     75      this->output_item(output, utf8convert, headerDone, metaItem, here->second.values);
     76    }
    7577      }
    7678      else {
     
    8688    // particular metadata is stuff we don't want?
    8789    if (doOutput) {
    88       this->output_item(output, utf8convert, headerDone, mapTo, here->second.values);
     90      if (this->is_valid_element(mapTo)) {
     91        this->output_item(output, utf8convert, headerDone, mapTo, here->second.values);
     92      }
    8993    }
    9094    else {
     
    115119  ofstream o("dummy", ios::out);
    116120  return this->scan_metadata(o, collection, docInfo, false);
     121}
     122
     123bool metaformat::is_valid_element(text_t &meta_name)
     124{
     125  if (elementSet.count(meta_name)==1) return true;
     126  return false;
     127 
    117128}
    118129
Note: See TracChangeset for help on using the changeset viewer.