source: trunk/gsdl/src/oaiservr/dublincore.cpp@ 8182

Last change on this file since 8182 was 8182, checked in by cs025, 20 years ago

Added OAI Server code to Greenstone

  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
1#include "dublincore.h"
2
3const text_t dublin_core::formatName() {
4 return "oai_dc";
5}
6
7const text_t dublin_core::formatPrefix() {
8 return "dc.";
9}
10
11bool dublin_core::output_record(ostream &output, recptproto *protocol, const text_t &collection,
12 const text_t &record_OID)
13{
14 return metaformat::output_record(output, protocol, collection, record_OID);
15}
16
17void dublin_core::output_metadata_header(ostream &output)
18{
19 output << " <metadata>\n";
20
21 if (this->oaiConfigure->getOAIVersion() <= 110){
22 // output dublin core wrapper for OAI v1.1
23 output << " <dc xmlns=\"http://purl.org/dc/elements/1.1/\"\n"
24 << " xmlns:xsi=\"http://www.w3c.org/2001/XMLSchema-instance\"\n"
25 << " xsi:schemaLocation=\"http://purl.org/dc/elements/1.1/\n"
26 << " http://www.openarchives.org/OAI/1.1/dc.xsd\">\n";
27 }
28 else {
29 output << " <oai_dc:dc\n"
30 << " xmlns:oai_dc=\"http://www.openarchives.org/OAI/2.0/oai_dc/\"\n"
31 << " xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n"
32 << " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
33 << " xsi:schemaLocation=\"http://www.openarchives.org/OAI/2.0/oai_dc/\n"
34 << " http://www.openarchives.org/OAI/2.0/oai_dc.xsd\">\n";
35 }
36}
37
38void dublin_core::output_metadata_footer(ostream &output)
39{
40 if (this->oaiConfigure->getOAIVersion() <= 110) {
41 output << " </dc>" << endl;
42 }
43 else {
44 output << " </oai_dc:dc>" << endl;
45 }
46
47 output << " </metadata>" << endl;
48 output.flush();
49}
50
51bool dublin_core::output_formatdata(ostream &output)
52{
53 output << " <metadataPrefix>oai_dc</metadataPrefix>" << endl;
54
55 if (this->oaiConfigure->getOAIVersion() <= 110) {
56 output << " <schema>http://www.openarchives.org/OAI/1.1/dc.xsd</schema>" << endl
57 << " <metadataNamespace>http://purl.org/dc/elements/1.1/</metadataNamespace>" << endl;
58 }
59 else {
60 output << " <schema>http://www.openarchives.org/OAI/2.0/oai_dc.xsd</schema>" << endl
61 << " <metadataNamespace>http://www.openarchives.org/OAI/2.0/oai_dc/</metadataNamespace>"
62 << endl;
63 }
64 return true;
65}
66
Note: See TracBrowser for help on using the repository browser.