diff --git a/D4ParserSax2.cc b/D4ParserSax2.cc index c9b7647f3..9df34327b 100644 --- a/D4ParserSax2.cc +++ b/D4ParserSax2.cc @@ -651,6 +651,9 @@ void D4ParserSax2::dmr_start_element(void *p, const xmlChar *l, const xmlChar *p if (parser->check_attribute("dmrVersion")) parser->dmr()->set_dmr_version(parser->xml_attrs["dmrVersion"].value); + if (parser->check_attribute("dap:serialization")) + parser->dmr()->set_serialization(parser->xml_attrs["dap:serialization"].value); + if (parser->check_attribute("base")) parser->dmr()->set_request_xml_base(parser->xml_attrs["base"].value); diff --git a/DDS.cc b/DDS.cc index 03e58c37b..71426b969 100644 --- a/DDS.cc +++ b/DDS.cc @@ -1257,7 +1257,11 @@ void DDS::print_dmr(ostream &out, bool constrained) { if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar *)"dmrVersion", (const xmlChar *)get_dmr_version().c_str()) < 0) - throw InternalErr(__FILE__, __LINE__, "Could not write attribute for dapVersion"); + throw InternalErr(__FILE__, __LINE__, "Could not write attribute for dmrVersion"); + + if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar *)"dap:serialization", + (const xmlChar *)get_serialization().c_str()) < 0) + throw InternalErr(__FILE__, __LINE__, "Could not write attribute for dap:serialization"); if (!get_request_xml_base().empty()) { if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar *)"xml:base", diff --git a/DDS.h b/DDS.h index 35de784d2..6f7ad95f7 100644 --- a/DDS.h +++ b/DDS.h @@ -286,6 +286,9 @@ class DDS : public DapObj { /** @brief Returns the DAP4 DMR version corresponding to DDS exports. */ string get_dmr_version() const { return "1.0"; } + /** @brief Returns the DAP4 data serialization scheme. */ + string get_serialization() const { return "4.0"; } + /// @deprecated void set_dap_major(int p); /// @deprecated diff --git a/DMR.cc b/DMR.cc index 9337618ac..402b4512b 100644 --- a/DMR.cc +++ b/DMR.cc @@ -68,6 +68,7 @@ void DMR::m_duplicate(const DMR &dmr) { d_dap_version = dmr.d_dap_version; // String version of the protocol d_dmr_version = dmr.d_dmr_version; + d_serialization = dmr.d_serialization; d_request_xml_base = dmr.d_request_xml_base; @@ -332,7 +333,11 @@ void DMR::print_dap4(XMLWriter &xml, bool constrained) { if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar *)"dmrVersion", (const xmlChar *)dmr_version().c_str()) < 0) - throw InternalErr(__FILE__, __LINE__, "Could not write attribute for dapVersion"); + throw InternalErr(__FILE__, __LINE__, "Could not write attribute for dmrVersion"); + + if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar *)"dap:serialization", + (const xmlChar *)serialization().c_str()) < 0) + throw InternalErr(__FILE__, __LINE__, "Could not write attribute for dap:serialization"); if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar *)"name", (const xmlChar *)name().c_str()) < 0) throw InternalErr(__FILE__, __LINE__, "Could not write attribute for name"); diff --git a/DMR.h b/DMR.h index 6464b0daf..1889a0500 100644 --- a/DMR.h +++ b/DMR.h @@ -73,8 +73,15 @@ class DMR : public DapObj { /// The version of the DMR document /// Version 1.0 is the original serialization scheme - Groups were serialized first, /// then the top-level variables. - /// The 2.0 version indicates the DAP4 Serialization bug fix. - std::string d_dmr_version = "2.0"; + std::string d_dmr_version = "1.0"; + + /// The version of the DMR document + /// Version 1.0 is the original serialization scheme - Groups were serialized first, + /// then the top-level variables. + /// When we fixed the DAP4 Serialization bug we added this along + /// with a Dataset xml attribute dap:serialization to express this state. + /// the original patch changed the d_dmr_version to 2.0 - ndp 4/14/26 + std::string d_serialization = "4.0"; /// The URL for the request base std::string d_request_xml_base; @@ -179,6 +186,15 @@ class DMR : public DapObj { */ void set_dmr_version(const std::string &v) { d_dmr_version = v; } + /** @brief Returns the DAP4 serialization that the source service will deliver. */ + std::string serialization() const { return d_serialization; } + + /** + * @brief Sets the DMR document version string. + * @param v DMR version value. + */ + void set_serialization(const std::string &v) { d_serialization = v; } + /// Get the URL that will return this DMR std::string request_xml_base() const { return d_request_xml_base; }