-
Notifications
You must be signed in to change notification settings - Fork 15
Dap4 serialization patch #354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
bb0b8d1
590fd41
112904d
73e6c18
f1ff2fe
5b8f87c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| // -*- mode: c++; c-basic-offset:4 -*- | ||
|
|
||
| // This file is part of libdap, A C++ implementation of the OPeNDAP Data | ||
| // Access Protocol. | ||
|
|
||
| // Copyright (c) 2026 OPeNDAP, Inc. | ||
| // Author: NAthan Potter <ndp@opendap.org> | ||
| // | ||
| // This library is free software; you can redistribute it and/or | ||
| // modify it under the terms of the GNU Lesser General Public | ||
| // License as published by the Free Software Foundation; either | ||
| // version 2.1 of the License, or (at your option) any later version. | ||
| // | ||
| // This library is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| // Lesser General Public License for more details. | ||
| // | ||
| // You should have received a copy of the GNU Lesser General Public | ||
| // License along with this library; if not, write to the Free Software | ||
| // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| // | ||
| // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112. | ||
| // | ||
| // cerealization_patch.h | ||
| // | ||
|
|
||
| #ifndef CEREALIZATION_PATCH_H | ||
| #define CEREALIZATION_PATCH_H | ||
|
|
||
| #define CEREALIZATION_PATCH_ATTR_NAME "hyrax_dap" | ||
|
Check failure on line 31 in cerealization_patch.h
|
||
| #define CEREALIZATION_PATCH_ATTR_VALUE "4.0" | ||
|
Check failure on line 32 in cerealization_patch.h
|
||
|
|
||
| #include "InternalErr.h" | ||
| #include "XMLWriter.h" | ||
| namespace libdap { | ||
|
|
||
| /** | ||
| * | ||
| * Adds the serialization patch attribute to the current element. | ||
| * @param xml | ||
| * @param dap4_namespace_name | ||
| */ | ||
| static void add_serialization_patch_attribute(libdap::XMLWriter &xml, const string &) { | ||
|
Check warning on line 44 in cerealization_patch.h
|
||
|
|
||
| /* | ||
| TODO - If we don't need a namespace prefix we can drop this bit. | ||
| if (!dap4_namespace_name.empty()) { | ||
| // Oddly, the dap namespace prefix is not defined by default. We have to add it to | ||
|
Check warning on line 49 in cerealization_patch.h
|
||
| // namespace prefix our special attribute. | ||
|
Check warning on line 50 in cerealization_patch.h
|
||
| if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar *)"xmlns:dap", | ||
| (const xmlChar *)dap4_namespace_name.c_str()) < 0) | ||
| throw libdap::InternalErr(__FILE__, __LINE__, "Could not write attribute for xmlns:dap"); | ||
| } | ||
| */ | ||
|
Check warning on line 55 in cerealization_patch.h
|
||
|
|
||
| // TODO - Is this really just a hyrax thing? Rethink this attribute name! | ||
|
Check warning on line 57 in cerealization_patch.h
|
||
| if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar *)CEREALIZATION_PATCH_ATTR_NAME, | ||
| (const xmlChar *)CEREALIZATION_PATCH_ATTR_VALUE) < 0) | ||
| throw libdap::InternalErr(__FILE__, __LINE__, "Could not write attribute for " CEREALIZATION_PATCH_ATTR_NAME); | ||
| } | ||
|
|
||
| } // namespace libdap | ||
|
|
||
| #endif // CEREALIZATION_PATCH_H | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with your idea to make the 'serialization = ...' XML attribute a function of the response - and resetting the 'dmrVersion' XML attribute to 1.0. This would mean that a DMR response does not have the 'serialization' attribute and uses 'dmrVersion = 1.0'. Then for the DAP response, the "DMR Part" does have the 'serialization' attribute and has the 'dmrVersion = 1.0'.
If you're going to do that, this would nominally be the place and and you could do that by adding a third parameter. You could keep this existing method by making the two parameter version call the new three parameter version (thus maintaining ABI of this class).