source: gsdl/trunk/runtime-src/src/oaiservr/rfc1807.cpp@ 18895

Last change on this file since 18895 was 18895, checked in by kjdon, 15 years ago

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.

  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1#include "rfc1807.h"
2
3rfc1807::rfc1807() : metaformat(){
4 // These element names taken from the schema
5 // http://www.openarchives.org/OAI/1.1/rfc1807.xsd
6 elementSet.insert("bib-version");
7 elementSet.insert("id");
8 elementSet.insert("entry");
9 elementSet.insert("organization");
10 elementSet.insert("title");
11 elementSet.insert("type");
12 elementSet.insert("revision");
13 elementSet.insert("withdraw");
14 elementSet.insert("author");
15 elementSet.insert("corp-author");
16 elementSet.insert("contact");
17 elementSet.insert("date");
18 elementSet.insert("pages");
19 elementSet.insert("copyright");
20 elementSet.insert("handle");
21 elementSet.insert("other_access");
22 elementSet.insert("retrieval");
23 elementSet.insert("keyword");
24 elementSet.insert("cr-category");
25 elementSet.insert("period");
26 elementSet.insert("series");
27 elementSet.insert("monitoring");
28 elementSet.insert("funding");
29 elementSet.insert("contract");
30 elementSet.insert("grant");
31 elementSet.insert("language");
32 elementSet.insert("notes");
33 elementSet.insert("abstract");
34
35};
36
37const text_t rfc1807::formatName()
38{
39 return "rfc1807";
40}
41
42const text_t rfc1807::formatPrefix() {
43 return "rfc1807";
44}
45
46bool rfc1807::output_record(ostream &output, recptproto *protocol, const text_t &collection,
47 const text_t &record_OID)
48{
49 return metaformat::output_record(output, protocol, collection, record_OID);
50}
51
52void rfc1807::output_metadata_header(ostream &output)
53{
54 output << "<metadata>\n";
55
56 if(this->oaiConfigure->getOAIVersion() <= 110){
57 // output rfc1807 wrapper for OAI v1.1
58 output << "<rfc1807 xmlns=\"http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1807.txt\"" << endl;
59 output << " xmlns:xsi=\"http://www.w3c.org/2001/XMLSchema-instance\"" << endl;
60 output << " xsi:schemaLocation=\"http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1807.txt"
61 << endl;
62 output << " http://www.openarchives.org/OAI/1.1/rfc1807.xsd\">" << endl;
63 }
64 else {
65 // TODO: output rfc1807 wrapper for OAI v2.0
66 output << "<rfc1807 xmlns=\"http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1807.txt\"" << endl;
67 output << " xmlns:xsi=\"http://www.w3c.org/2001/XMLSchema-instance\"" << endl;
68 output << " xsi:schemaLocation=\"http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1807.txt"
69 << endl;
70 output << " http://www.openarchives.org/OAI/1.1/rfc1807.xsd\">" << endl;
71 }
72}
73
74void rfc1807::output_metadata_footer(ostream &output)
75{
76 // end rfc1807 wrapper
77 output << "</rfc1807>" << endl;
78
79 output << "</metadata>\n";
80}
81
82bool rfc1807::output_formatdata(ostream &output)
83{
84 // Both versions of the protocol use the same schema (yes?)
85 output << " <metadataPrefix>rfc1807</metadataPrefix>" << endl;
86 output << " <schema>http://www.openarchives.org/OAI/1.1/rfc1807.xsd</schema>" << endl;
87 // N.B.: no namespace for this format
88 output << " <metadataNamespace></metadataNamespace>" << endl;
89
90 return true;
91}
92
93
Note: See TracBrowser for help on using the repository browser.