62 const string c_xml_xsi =
"http://www.w3.org/2001/XMLSchema-instance";
76 DMR::m_duplicate(
const DMR &dmr)
81 d_factory = dmr.d_factory;
84 d_filename = dmr.d_filename;
86 d_dap_major = dmr.d_dap_major;
87 d_dap_minor = dmr.d_dap_minor;
88 d_dap_version = dmr.d_dap_version;
90 d_dmr_version = dmr.d_dmr_version;
92 d_request_xml_base = dmr.d_request_xml_base;
94 d_namespace = dmr.d_namespace;
96 d_max_response_size = dmr.d_max_response_size;
100 DBG(cerr <<
"dmr.d_root: " << dmr.d_root << endl);
101 DBG(cerr <<
"d_root (from ptr_dup(): " << d_root << endl);
119 : d_factory(factory), d_name(name), d_filename(
""),
120 d_dap_major(4), d_dap_minor(0),
121 d_dmr_version(
"1.0"), d_request_xml_base(
""),
149 : d_factory(factory), d_name(dds.get_dataset_name()),
150 d_filename(dds.filename()), d_dap_major(4), d_dap_minor(0),
151 d_dmr_version(
"1.0"), d_request_xml_base(
""),
181 : d_factory(0), d_name(
""), d_filename(
""), d_dap_major(4), d_dap_minor(0),
182 d_dap_version(
"4.0"), d_dmr_version(
"1.0"), d_request_xml_base(
""),
257 istringstream iss(v);
259 int major = -1, minor = -1;
261 if (!iss.eof() && !iss.fail())
263 if (!iss.eof() && !iss.fail())
265 if (!iss.eof() && !iss.fail())
268 if (major == -1 || minor == -1 or dot !=
'.')
269 throw InternalErr(__FILE__, __LINE__,
"Could not parse dap version. Value given: " + v);
280 switch (d_dap_major) {
316 if (xmlTextWriterStartElement(xml.
get_writer(), (
const xmlChar*)
"Dataset") < 0)
317 throw InternalErr(__FILE__, __LINE__,
"Could not write Dataset element");
321 if (xmlTextWriterWriteAttribute(xml.
get_writer(), (
const xmlChar*)
"xmlns:xml",
323 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:xml");
325 if (xmlTextWriterWriteAttribute(xml.
get_writer(), (
const xmlChar*)
"xmlns:xsi", (
const xmlChar*)
c_xml_xsi.c_str())
327 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:xsi");
329 if (xmlTextWriterWriteAttribute(xml.
get_writer(), (
const xmlChar*)
"xsi:schemaLocation",
331 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:schemaLocation");
334 if (xmlTextWriterWriteAttribute(xml.
get_writer(), (
const xmlChar*)
"xmlns", (
const xmlChar*)
get_namespace().c_str()) < 0)
335 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns");
338 if (xmlTextWriterWriteAttribute(xml.
get_writer(), (
const xmlChar*)
"xml:base",
340 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xml:base");
343 if (xmlTextWriterWriteAttribute(xml.
get_writer(), (
const xmlChar*)
"dapVersion", (
const xmlChar*)
dap_version().c_str()) < 0)
344 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for dapVersion");
346 if (xmlTextWriterWriteAttribute(xml.
get_writer(), (
const xmlChar*)
"dmrVersion", (
const xmlChar*)
dmr_version().c_str()) < 0)
347 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for dapVersion");
349 if (xmlTextWriterWriteAttribute(xml.
get_writer(), (
const xmlChar*)
"name", (
const xmlChar*)
name().c_str()) < 0)
350 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
354 if (xmlTextWriterEndElement(xml.
get_writer()) < 0)
355 throw InternalErr(__FILE__, __LINE__,
"Could not end the top-level Group element");
370 << (
void *)
this <<
")" << endl ;
string dap_version() const
xmlTextWriterPtr get_writer()
void print_dap4(XMLWriter &xml, bool constrained=false)
Vars_iter var_begin()
Return an iterator to the first variable.
string dmr_version() const
virtual void add_var_nocopy(BaseType *bt, Part part=nil)
virtual void dump(ostream &strm) const
dumps information about this object
const string c_default_dap40_schema_location
string request_xml_base() const
Get the URL that will return this DMR/DDX/DataThing.
A class for software fault reporting.
DMR & operator=(const DMR &rhs)
const string c_dap_40_n_sl
long request_size(bool constrained)
std::vector< BaseType * >::iterator Vars_iter
long request_size(bool constrained)
Get the estimated response size, in kilo bytes.
virtual D4Attributes * attributes()
virtual AttrTable & get_attr_table()
virtual void build_using_dds(DDS &dds)
Vars_iter var_end()
Return an iterator.
static ostream & LMarg(ostream &strm)
The basic data type for the DODS DAP types.
libdap base object for common functionality of libdap objects
string get_namespace() const
Get the namespace associated with the DDS - likely set only by DDX responses.
void m_duplicate(const DMR &dmr)
void set_dap_version(const string &version_string)
void print_dap4(XMLWriter &xml, bool constrained=false)
const string c_dap40_namespace
virtual D4Group * ptr_duplicate()
string get_dataset_name() const
void set_name(const string &n)
void transform_to_dap4(AttrTable &at)
copy attributes from DAP2 to DAP4
void set_filename(const string &fn)
virtual BaseType * NewVariable(Type t, const string &name) const
const string c_xml_namespace
virtual BaseType * transform_to_dap4(D4Group *root, Constructor *container)
DAP2 to DAP4 transform.