[mapserver-commits] r7273 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Thu Jan 17 19:53:58 EST 2008


Author: tomkralidis
Date: 2008-01-17 19:53:58 -0500 (Thu, 17 Jan 2008)
New Revision: 7273

Modified:
   trunk/mapserver/mapowscommon.c
   trunk/mapserver/mapowscommon.h
Log:
update to support both 1.0.0 and 1.1.0 (#2071)


Modified: trunk/mapserver/mapowscommon.c
===================================================================
--- trunk/mapserver/mapowscommon.c	2008-01-17 22:57:47 UTC (rev 7272)
+++ trunk/mapserver/mapowscommon.c	2008-01-18 00:53:58 UTC (rev 7273)
@@ -3,6 +3,9 @@
  * Name:     mapowscommon.c
  * Project:  MapServer
  * Purpose:  OGC OWS Common Implementation for use by MapServer OGC code
+ *           versions:
+ *           1.0.0 (OGC Document 05-008c1)
+ *           1.1.0 (OGC document 06-121r3)
  *           
  * Author:   Tom Kralidis (tomkralidis at hotmail.com)
  *
@@ -29,6 +32,7 @@
  ****************************************************************************/
 
 #include "mapserver.h"
+#include "mapows.h"
 
 #ifdef USE_LIBXML2
 
@@ -43,8 +47,11 @@
 /**
  * msOWSCommonServiceIdentification()
  *
- * returns an object of ServiceIdentification as per subclause 7.4.3
+ * returns an object of ServiceIdentification as per:
  *
+ * 1.0.0 subclause 7.4.3
+ * 1.1.1 subclause 7.4.4
+ *
  * @param map mapObj used to fetch WEB/METADATA
  * @param servicetype the OWS type
  * @param version the version of the OWS
@@ -135,8 +142,12 @@
 /**
  * msOWSCommonServiceProvider()
  *
- * returns an object of ServiceProvider as per subclause 7.4.4
+ * returns an object of ServiceProvider as per:
+ * 
  *
+ * 1.0.0 subclause 7.4.4
+ * 1.1.0 subclause 7.4.5
+ *
  * @param map mapObj to fetch MAP/WEB/METADATA
  *
  * @return psRootNode xmlNodePtr pointer of XML construct
@@ -311,8 +322,11 @@
 /**
  * msOWSCommonOperationsMetadata()
  *
- * returns the root element of OperationsMetadata as per subclause 7.4.5
+ * returns the root element of OperationsMetadata as per:
  *
+ * 1.0.0 subclause 7.4.5
+ * 1.1.0 subclause 7.4.6
+ *
  * @return psRootNode xmlNodePtr pointer of XML construct
  *
  */
@@ -330,7 +344,10 @@
 /**
  * msOWSCommonOperationsMetadataOperation()
  *
- * returns an Operation element of OperationsMetadata as per subclause 7.4.5
+ * returns an Operation element of OperationsMetadata as per:
+ * 
+ * 1.0.0 subclause 7.4.5
+ * 1.1.0 subclause 7.4.6
  *
  * @param name name of the Operation
  * @param method HTTP method: OWS_METHOD_GET, OWS_METHOD_POST or OWS_METHOD_GETPOST)
@@ -376,8 +393,12 @@
  * msOWSCommonOperationsMetadataDomainType()
  *
  * returns a Parameter or Constraint element (which are of type ows:DomainType)
- * of OperationsMetadata as per subclause 7.4.5
+ * of OperationsMetadata as per:
  *
+ * 1.0.0 subclause 7.4.5
+ * 1.1.0 subclause 7.4.6
+ *
+ * @param version the integerized x.y.z version of OWS Common to use
  * @param elname name of the element (Parameter | Constraint)
  * @param name name of the Parameter
  * @param values list of values (comma seperated list) or NULL if none
@@ -386,8 +407,9 @@
  *
  */
 
-xmlNodePtr msOWSCommonOperationsMetadataDomainType(xmlNsPtr psNsOws, char *elname, char *name, char *values) {
+xmlNodePtr msOWSCommonOperationsMetadataDomainType(int version, xmlNsPtr psNsOws, char *elname, char *name, char *values) {
   xmlNodePtr psRootNode = NULL;
+  xmlNodePtr psNode = NULL;
 
   if (_validateNamespace(psNsOws) == MS_FAILURE)
     psNsOws = xmlNewNs(psRootNode, BAD_CAST MS_OWSCOMMON_OWS_NAMESPACE_URI, BAD_CAST MS_OWSCOMMON_OWS_NAMESPACE_PREFIX);
@@ -396,7 +418,13 @@
 
   xmlNewProp(psRootNode, BAD_CAST "name", BAD_CAST name);
 
-  msLibXml2GenerateList(psRootNode, psNsOws, "Value", values, ',');
+  if (version == OWS_1_0_0) {
+    msLibXml2GenerateList(psRootNode, psNsOws, "Value", values, ',');
+  }
+  if (version == OWS_1_1_0) {
+    psNode = xmlNewChild(psRootNode, psNsOws, BAD_CAST "AllowedValues", NULL);
+    msLibXml2GenerateList(psNode, psNsOws, "Value", values, ',');
+  }
 
   return psRootNode;
 }
@@ -406,6 +434,7 @@
  *
  * returns an object of ExceptionReport as per clause 8
  *
+ * @param ows_version the version of OWS Common to use
  * @param schemas_location URL to OGC Schemas Location base
  * @param version the version of the calling specification
  * @param language ISO3166 code of language
@@ -417,15 +446,16 @@
  *
  */
 
-xmlNodePtr msOWSCommonExceptionReport(const char *schemas_location, const char *version, const char *language, const char *exceptionCode, const char *locator, const char *ExceptionText) {
+xmlNodePtr msOWSCommonExceptionReport(xmlNsPtr psNsOws, int ows_version, const char *schemas_location, const char *version, const char *language, const char *exceptionCode, const char *locator, const char *ExceptionText) {
   char *xsi_schemaLocation = NULL;
+  char *ows_version_string = NULL;
 
   xmlNsPtr     psNsXsi     = NULL;
   xmlNodePtr   psRootNode  = NULL;
   xmlNodePtr   psMainNode  = NULL;
   xmlNodePtr   psNode      = NULL;
 
-  psRootNode = xmlNewNode(NULL, BAD_CAST "ExceptionReport");
+  psRootNode = xmlNewNode(psNsOws, BAD_CAST "ExceptionReport");
 
   psNsXsi = xmlNewNs(psRootNode, BAD_CAST MS_OWSCOMMON_W3C_XSI_NAMESPACE_URI, BAD_CAST MS_OWSCOMMON_W3C_XSI_NAMESPACE_PREFIX);
 
@@ -433,13 +463,22 @@
   xmlNewProp(psRootNode, BAD_CAST "version", BAD_CAST version);
 
   if (language !=  "undefined") {
-    xmlNewProp(psRootNode, BAD_CAST "language", BAD_CAST language);
+    if (ows_version == OWS_1_0_0) {
+      ows_version_string = strdup("1.0.0");
+      xmlNewProp(psRootNode, BAD_CAST "language", BAD_CAST language);
+    }
+    if (ows_version == OWS_1_1_0) {
+      ows_version_string = strdup("1.1.0");
+      xmlNewProp(psRootNode, BAD_CAST "xml:lang", BAD_CAST language);
+    }
   }
 
-  xsi_schemaLocation = strdup(MS_OWSCOMMON_OWS_NAMESPACE_URI);
+  xsi_schemaLocation = strdup((char *)psNsOws->href);
   xsi_schemaLocation = msStringConcatenate(xsi_schemaLocation, " ");
   xsi_schemaLocation = msStringConcatenate(xsi_schemaLocation, (char *)schemas_location);
-  xsi_schemaLocation = msStringConcatenate(xsi_schemaLocation, "/ows/1.0.0/owsExceptionReport.xsd");
+  xsi_schemaLocation = msStringConcatenate(xsi_schemaLocation, "/ows/");
+  xsi_schemaLocation = msStringConcatenate(xsi_schemaLocation, (char *)ows_version_string);
+  xsi_schemaLocation = msStringConcatenate(xsi_schemaLocation, "/owsExceptionReport.xsd");
 
   /* add namespace'd attributes to root element */
   xmlNewNsProp(psRootNode, psNsXsi, BAD_CAST "schemaLocation", BAD_CAST xsi_schemaLocation);
@@ -526,7 +565,7 @@
 /**
  * msOWSCommonWGS84BoundingBox()
  *
- * returns an object of BoundingBox as per subclause 10.2.2
+ * returns an object of WGS84BoundingBox as per subclause 10.2.2
  *
  * @param psNsOws OWS namespace object
  * @param dimensions number of dimensions of the coordinates

Modified: trunk/mapserver/mapowscommon.h
===================================================================
--- trunk/mapserver/mapowscommon.h	2008-01-17 22:57:47 UTC (rev 7272)
+++ trunk/mapserver/mapowscommon.h	2008-01-18 00:53:58 UTC (rev 7273)
@@ -54,6 +54,8 @@
 #define MS_OWSCOMMON_OWS_NAMESPACE_URI      "http://www.opengis.net/ows"
 #define MS_OWSCOMMON_OWS_NAMESPACE_PREFIX   "ows"
 
+#define MS_OWSCOMMON_OWS_110_NAMESPACE_URI      "http://www.opengis.net/ows/1.1"
+
 /* OGC URNs */
 
 #define MS_OWSCOMMON_URN_OGC_CRS_4326 "urn:opengis:def:crs:OGC:2:84"
@@ -80,9 +82,9 @@
 
 xmlNodePtr msOWSCommonOperationsMetadataOperation(xmlNsPtr psNsOws, xmlNsPtr psXLinkNs, char *name, int method, char *url);
 
-xmlNodePtr msOWSCommonOperationsMetadataDomainType(xmlNsPtr psNsOws, char *elname, char *name, char *values);
+xmlNodePtr msOWSCommonOperationsMetadataDomainType(int version, xmlNsPtr psNsOws, char *elname, char *name, char *values);
 
-xmlNodePtr msOWSCommonExceptionReport(const char *schemas_location, const char *version, const char *language, const char *exceptionCode, const char *locator, const char *ExceptionText);
+xmlNodePtr msOWSCommonExceptionReport(xmlNsPtr psNsOws, int ows_version, const char *schemas_location, const char *version, const char *language, const char *exceptionCode, const char *locator, const char *ExceptionText);
 
 xmlNodePtr msOWSCommonBoundingBox(xmlNsPtr psNsOws, const char *crs, int dimensions, double minx, double miny, double maxx, double maxy);
 



More information about the mapserver-commits mailing list