[OpenLayers-Commits] r11959 - in trunk/openlayers: lib/OpenLayers/Format/CSWGetRecords tests/Format/CSWGetRecords

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Mon May 9 03:52:44 EDT 2011


Author: erilem
Date: 2011-05-09 00:52:39 -0700 (Mon, 09 May 2011)
New Revision: 11959

Modified:
   trunk/openlayers/lib/OpenLayers/Format/CSWGetRecords/v2_0_2.js
   trunk/openlayers/tests/Format/CSWGetRecords/v2_0_2.html
   trunk/openlayers/tests/Format/CSWGetRecords/v2_0_2.js
Log:
CSWGetRecords format additions for parsing GeoNetwork specific fields, p=fvanderbiest, r=bartvde,me (closes #2961)

Modified: trunk/openlayers/lib/OpenLayers/Format/CSWGetRecords/v2_0_2.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Format/CSWGetRecords/v2_0_2.js	2011-05-09 07:36:57 UTC (rev 11958)
+++ trunk/openlayers/lib/OpenLayers/Format/CSWGetRecords/v2_0_2.js	2011-05-09 07:52:39 UTC (rev 11959)
@@ -27,13 +27,14 @@
      * {Object} Mapping of namespace aliases to namespace URIs.
      */
     namespaces: {
-        xlink: "http://www.w3.org/1999/xlink",
-        xsi: "http://www.w3.org/2001/XMLSchema-instance",
         csw: "http://www.opengis.net/cat/csw/2.0.2",
         dc: "http://purl.org/dc/elements/1.1/",
         dct: "http://purl.org/dc/terms/",
+        geonet: "http://www.fao.org/geonetwork",
+        ogc: "http://www.opengis.net/ogc",
         ows: "http://www.opengis.net/ows",
-        ogc: "http://www.opengis.net/ogc"
+        xlink: "http://www.w3.org/1999/xlink",
+        xsi: "http://www.w3.org/2001/XMLSchema-instance"
     },
     
     /**
@@ -233,8 +234,19 @@
                 var record = {type: "Record"};
                 this.readChildNodes(node, record);
                 obj.records.push(record);
+            },
+            "*": function(node, obj) {
+                var name = node.localName || node.nodeName.split(":").pop();
+                obj[name] = this.getChildValue(node);
             }
         },
+        "geonet": {
+            "info": function(node, obj) {
+                var gninfo = {};
+                this.readChildNodes(node, gninfo);
+                obj.gninfo = gninfo;
+            }
+        },
         "dc": {
             // audience, contributor, coverage, creator, date, description, format,
             // identifier, language, provenance, publisher, relation, rights,

Modified: trunk/openlayers/tests/Format/CSWGetRecords/v2_0_2.html
===================================================================
--- trunk/openlayers/tests/Format/CSWGetRecords/v2_0_2.html	2011-05-09 07:36:57 UTC (rev 11958)
+++ trunk/openlayers/tests/Format/CSWGetRecords/v2_0_2.html	2011-05-09 07:52:39 UTC (rev 11959)
@@ -41,10 +41,10 @@
     
     function test_read(t) {
         
-        t.plan(14);
+        t.plan(16);
         
         var obj = format.read(csw_response);
-        
+                
         var searchStatus = obj.SearchStatus;
         var searchResults = obj.SearchResults;
         var records = obj.records;
@@ -72,6 +72,10 @@
         t.eq(bbox.crs, "::Lambert Azimuthal Projection", "check value for BoundingBox.crs");
         t.eq(bbox.value, [156, -3, 37, 83], "check value for record.BoundingBox");
         
+        // test gninfo
+        testRecord = records[1];
+        t.ok(testRecord.gninfo, "object contains gninfo properties");
+        t.eq(testRecord.gninfo.schema, "iso19139", "check value for schema property in record.gninfo");
     }
     
     </script> 

Modified: trunk/openlayers/tests/Format/CSWGetRecords/v2_0_2.js
===================================================================
--- trunk/openlayers/tests/Format/CSWGetRecords/v2_0_2.js	2011-05-09 07:36:57 UTC (rev 11958)
+++ trunk/openlayers/tests/Format/CSWGetRecords/v2_0_2.js	2011-05-09 07:52:39 UTC (rev 11959)
@@ -37,6 +37,10 @@
         '<ows:LowerCorner>51.1 -34.6</ows:LowerCorner>' +
         '<ows:UpperCorner>-17.3 38.2</ows:UpperCorner>' +
       '</ows:BoundingBox>' +
+      '<geonet:info xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gml="http://www.opengis.net/gml">' +
+        '<id>859</id>' +
+        '<schema>iso19139</schema>' +
+      '</geonet:info>' +
     '</csw:BriefRecord>' +
   '</csw:SearchResults>' +
 '</csw:GetRecordsResponse>'



More information about the Commits mailing list