libdap
Updated for version 3.20.3
libdap4 is an implementation of OPeNDAP's DAP protocol.
DapXmlNamespaces.h
1
// -*- mode: c++; c-basic-offset:4 -*-
2
3
// This file is part of libdap, A C++ implementation of the OPeNDAP Data
4
// Access Protocol.
5
6
// Copyright (c) 2017 OPeNDAP, Inc.
7
// Author: Nathan Potter <ndp@opendap.org>
8
//
9
// This library is free software; you can redistribute it and/or
10
// modify it under the terms of the GNU Lesser General Public
11
// License as published by the Free Software Foundation; either
12
// version 2.1 of the License, or (at your option) any later version.
13
//
14
// This library is distributed in the hope that it will be useful,
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
// Lesser General Public License for more details.
18
//
19
// You should have received a copy of the GNU Lesser General Public
20
// License along with this library; if not, write to the Free Software
21
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
//
23
// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
24
25
#ifndef DAPXMLNAMSPACES_H_
26
#define DAPXMLNAMSPACES_H_
27
28
#include <string>
29
30
namespace
libdap
{
31
32
enum
DAPVersion { DAP_2_0, DAP_3_2, DAP_4_0 };
33
34
class
DapXmlNamspaces
{
35
36
public
:
37
38
virtual
~
DapXmlNamspaces
() {};
39
43
static
std::string
getXmlXsiNamespace
(){
44
return
"http://www.w3.org/2001/XMLSchema-instance"
;
45
}
46
50
static
std::string
getXmlNamespace
(){
51
return
"http://www.w3.org/XML/1998/namespace"
;
52
}
53
57
static
std::string
getGrddlTransformation
(DAPVersion version){
58
59
switch
(version) {
60
case
DAP_2_0:
61
throw
InternalErr
(__FILE__, __LINE__,
"DapXmlNamspaces::getDapXmlNamespaceString() - GRDDL Transformation undefined for DAP 2.0"
);
62
break
;
63
64
case
DAP_3_2:
65
return
"http://xml.opendap.org/transforms/ddxToRdfTriples.xsl"
;
66
break
;
67
68
case
DAP_4_0:
69
throw
InternalErr
(__FILE__, __LINE__,
"DapXmlNamspaces::getDapXmlNamespaceString() - GRDDL Transformation undefined for DAP 4.0"
);
70
break
;
71
72
default
:
73
throw
InternalErr
(__FILE__, __LINE__,
"DapXmlNamspaces::getDapXmlNamespaceString() - Unrecognized namespace version."
);
74
break
;
75
}
76
}
77
78
79
80
84
static
std::string
getDapNamespaceString
(DAPVersion version){
85
86
switch
(version) {
87
case
DAP_2_0:
88
return
"http://xml.opendap.org/ns/DAP2"
;
89
break
;
90
91
case
DAP_3_2:
92
return
"http://xml.opendap.org/ns/DAP/3.2#"
;
93
break
;
94
95
case
DAP_4_0:
96
return
"http://xml.opendap.org/ns/DAP/4.0#"
;
97
break
;
98
99
default
:
100
throw
InternalErr
(__FILE__, __LINE__,
"DapXmlNamspaces::getDapXmlNamespaceString() - Unrecognized namespace version."
);
101
break
;
102
}
103
}
104
108
static
std::string
getSchemaLocationString
(DAPVersion version){
109
110
switch
(version) {
111
case
DAP_2_0:
112
return
"http://xml.opendap.org/dap/dap2.xsd"
;
113
break
;
114
115
case
DAP_3_2:
116
return
"http://xml.opendap.org/dap/dap3.2.xsd"
;
117
break
;
118
119
case
DAP_4_0:
120
return
"http://xml.opendap.org/dap/dap4.0.xsd"
;
121
break
;
122
123
default
:
124
throw
InternalErr
(__FILE__, __LINE__,
"DapXmlNamspaces::getSchemaLocationString() - Unrecognized namespace version."
);
125
break
;
126
}
127
}
128
129
130
135
static
std::string
getSchemaLocationDeclarationString
(DAPVersion version){
136
return
getDapNamespaceString
(version).append(
" "
).append(
getSchemaLocationString
(version));
137
}
138
139
};
140
141
142
}
/* namespace libdap */
143
#endif
/* DAPXMLNAMSPACES_H_ */
libdap::DapXmlNamspaces::getXmlNamespace
static std::string getXmlNamespace()
Definition:
DapXmlNamespaces.h:50
libdap::DapXmlNamspaces::getDapNamespaceString
static std::string getDapNamespaceString(DAPVersion version)
Definition:
DapXmlNamespaces.h:84
libdap::InternalErr
A class for software fault reporting.
Definition:
InternalErr.h:65
libdap
top level DAP object to house generic methods
Definition:
AlarmHandler.h:36
libdap::DapXmlNamspaces
Definition:
DapXmlNamespaces.h:34
libdap::DapXmlNamspaces::getSchemaLocationDeclarationString
static std::string getSchemaLocationDeclarationString(DAPVersion version)
Definition:
DapXmlNamespaces.h:135
libdap::DapXmlNamspaces::getSchemaLocationString
static std::string getSchemaLocationString(DAPVersion version)
Definition:
DapXmlNamespaces.h:108
libdap::DapXmlNamspaces::getGrddlTransformation
static std::string getGrddlTransformation(DAPVersion version)
Definition:
DapXmlNamespaces.h:57
libdap::DapXmlNamspaces::getXmlXsiNamespace
static std::string getXmlXsiNamespace()
Definition:
DapXmlNamespaces.h:43
DapXmlNamespaces.h
Generated by
1.8.20