[OpenLayers-Commits] r12450 - sandbox/camptocamp/ifremer/openlayers/lib/OpenLayers/Format/CSWGetRecords

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Wed Jan 11 11:19:04 EST 2012


Author: fvanderbiest
Date: 2012-01-11 08:19:03 -0800 (Wed, 11 Jan 2012)
New Revision: 12450

Modified:
   sandbox/camptocamp/ifremer/openlayers/lib/OpenLayers/Format/CSWGetRecords/v2_0_2.js
Log:
[camptocamp/ifremer] ISO19139 CSW getRecords parsing revisited

Modified: sandbox/camptocamp/ifremer/openlayers/lib/OpenLayers/Format/CSWGetRecords/v2_0_2.js
===================================================================
--- sandbox/camptocamp/ifremer/openlayers/lib/OpenLayers/Format/CSWGetRecords/v2_0_2.js	2012-01-11 16:14:25 UTC (rev 12449)
+++ sandbox/camptocamp/ifremer/openlayers/lib/OpenLayers/Format/CSWGetRecords/v2_0_2.js	2012-01-11 16:19:03 UTC (rev 12450)
@@ -135,6 +135,196 @@
         splitSpace: (/\s+/),
         trimComma: (/\s*,\s*/g)
     },
+    
+    parsers: {
+        // readAttributes
+        "CI_RoleCode": "readAttributes",
+        "MD_ProgressCode": "readAttributes",
+        "MD_KeywordTypeCode": "readAttributes",
+        "MD_RestrictionCode": "readAttributes",
+        "MD_SpatialRepresentationTypeCode": "readAttributes",
+        "MD_CharacterSetCode": "readAttributes",
+        "CI_DateTypeCode": "readAttributes",
+        "MD_TopologyLevelCode": "readAttributes",
+        "MD_GeometricObjectTypeCode": "readAttributes",
+        "MD_DimensionNameTypeCode": "readAttributes",
+        "MD_CellGeometryCode": "readAttributes",
+        "MD_MaintenanceFrequencyCode": "readAttributes",
+        "MD_ScopeCode": "readAttributes",
+        // pass
+        "CI_ResponsibleParty": "pass",
+        "CI_Contact": "pass",
+        "CI_Telephone": "pass",
+        "CI_Address": "pass",
+        "MD_DataIdentification": "pass",
+        "MD_Keywords": "pass",
+        "MD_LegalConstraints": "pass",
+        "MD_Resolution": "pass",
+        "MD_RepresentativeFraction": "pass",
+        "EX_Extent": "pass",
+        "EX_GeographicBoundingBox": "pass",
+        "EX_TemporalExtent": "pass",
+        "MD_Distribution": "pass",
+        "MD_Distributor": "pass",
+        "MD_DigitalTransferOptions": "pass",
+        "MD_Format": "pass",
+        "MD_Medium": "pass",
+        "CI_OnlineResource": "pass",
+        "MD_ReferenceSystem": "pass",
+        "RS_Identifier": "pass",
+        "CI_Citation": "pass",
+        "CI_Date": "pass",
+        "MD_GridSpatialRepresentation": "pass",
+        "MD_VectorSpatialRepresentation": "pass",
+        "MD_GeometricObjects": "pass",
+        "MD_Dimension": "pass",
+        "MD_MaintenanceInformation": "pass",
+        "MD_ScopeDescription": "pass",
+        "MD_BrowseGraphic": "pass",
+        "DQ_DataQuality": "pass",
+        "DQ_Scope": "pass",
+        "DQ_Element": "pass",
+        "LI_Lineage": "pass",
+        "LI_Source":"pass",
+        "LI_ProcessStep":"pass",
+        "MD_ReferenceSystem":"pass",
+        // createManyChildren
+        "contact": "createManyChildren",
+        "voice": "createManyChildren",
+        "facsimile": "createManyChildren",
+        "deliveryPoint": "createManyChildren",
+        "electronicMailAddress": "createManyChildren",
+        "identificationInfo": "createManyChildren",
+        "pointOfContact": "createManyChildren",
+        "status": "createManyChildren",
+        "descriptiveKeywords": "createManyChildren",
+        "keyword": "createManyChildren",
+        "resourceConstraints": "createManyChildren",
+        "useLimitation": "createManyChildren",
+        "accessConstraints": "createManyChildren",
+        "useConstraints": "createManyChildren",
+        "otherConstraints": "createManyChildren",
+        "spatialResolution": "createManyChildren",
+        "spatialRepresentationType": "createManyChildren",
+        "language": "createManyChildren",
+        "characterSet": "createManyChildren",
+        "topicCategory": "createManyChildren",
+        "geographicElement": "createManyChildren",
+        "temporalElement": "createManyChildren",
+        "distributor": "createManyChildren",
+        "transferOptions": "createManyChildren",
+        "distributionFormat": "createManyChildren",
+        "distributionOrderProcess": "createManyChildren",
+        "distributorFormat": "createManyChildren",
+        "formatDistributor": "createManyChildren",
+        "distributorTransferOptions": "createManyChildren",
+        "onLine": "createManyChildren",
+        "referenceSystemInfo": "createManyChildren",
+        "alternateTitle": "createManyChildren",
+        "date": "createManyChildren",
+        "identifier": "createManyChildren",
+        "citedResponsibleParty": "createManyChildren",
+        "presentationForm": "createManyChildren",
+        "spatialRepresentationInfo": "createManyChildren",
+        "geometricObjects": "createManyChildren",
+        "axisDimensionProperties": "createManyChildren",
+        "resourceMaintenance": "createManyChildren",
+        "updateScope": "createManyChildren",
+        "updateScopeDescription": "createManyChildren",
+        "maintenanceNote": "createManyChildren",
+        "attributes": "createManyChildren",
+        "features": "createManyChildren",
+        "featureInstances": "createManyChildren",
+        "attributeInstances": "createManyChildren",
+        "graphicOverview": "createManyChildren",
+        "dataQualityInfo": "createManyChildren",
+        "report": "createManyChildren",
+        "levelDescription":"createManyChildren",
+        "processStep":"createManyChildren",
+        "source":"createManyChildren",
+        "sourceExtent":"createManyChildren",
+        "sourceStep":"createManyChildren",
+        "processor":"createManyChildren",
+        // createOneChild
+        "dateTime":"createOneChild",
+        "rationale":"createOneChild",
+        "description":"createOneChild",
+        "statement":"createOneChild",
+        "scaleDenominator":"createOneChild",
+        "sourceReferenceSystem":"createOneChild",
+        "sourceCitation":"createOneChild",
+        "level": "createOneChild",
+        "scope": "createOneChild",
+        "lineage": "createOneChild",
+        "fileName":"createOneChild",
+        "fileDescription":"createOneChild",
+        "fileType":"createOneChild",
+        "other":"createOneChild",
+        "maintenanceAndUpdateFrequency":"createOneChild",
+        "userDefinedMaintenanceFrequency":"createOneChild",
+        "dataset":"createOneChild",
+        "citation":"createOneChild",
+        "dateOfNextUpdate":"createOneChild",
+        "dimensionName":"createOneChild",
+        "dimensionSize":"createOneChild",
+        "resolution":"createOneChild",
+        "numberOfDimensions":"createOneChild",
+        "cellGeometry":"createOneChild",
+        "transformationParameterAvailability":"createOneChild",
+        "geometricObjectType":"createOneChild",
+        "geometricObjectCount":"createOneChild",
+        "topologyLevel":"createOneChild",
+        "dateType":"createOneChild",
+        "title":"createOneChild",
+        "edition":"createOneChild",
+        "editionDate":"createOneChild",
+        "series":"createOneChild",
+        "otherCitationDetails":"createOneChild",
+        "collectiveTitle":"createOneChild",
+        "ISBN":"createOneChild",
+        "ISSN":"createOneChild",
+        "authority":"createOneChild",
+        "code":"createOneChild",
+        "referenceSystemIdentifier":"createOneChild",
+        "linkage":"createOneChild",
+        "protocol":"createOneChild",
+        "unitsOfDistribution":"createOneChild",
+        "transferSize":"createOneChild",
+        "offLine":"createOneChild",
+        "name":"createOneChild",
+        "version":"createOneChild",
+        "amendmentNumber":"createOneChild",
+        "specification":"createOneChild",
+        "fileDecompressionTechnique":"createOneChild",
+        "distributorContact":"createOneChild",
+        "distributionInfo":"createOneChild",
+        "westBoundLongitude":"createOneChild",
+        "eastBoundLongitude":"createOneChild",
+        "southBoundLatitude":"createOneChild",
+        "northBoundLatitude":"createOneChild",
+        "supplementalInformation":"createOneChild",
+        "denominator":"createOneChild",
+        "equivalentScale":"createOneChild",
+        "type":"createOneChild",
+        "purpose":"createOneChild",
+        "abstract":"createOneChild",
+        "city":"createOneChild",
+        "administrativeArea":"createOneChild",
+        "postalCode":"createOneChild",
+        "country":"createOneChild",
+        "address":"createOneChild",
+        "phone":"createOneChild",
+        "contactInfo":"createOneChild",
+        "role": "createOneChild",
+        "fileIdentifier": "createOneChild",
+        "language": "createOneChild",
+        "dateStamp": "createOneChild",
+        "metadataStandardName": "createOneChild",
+        "metadataStandardVersion": "createOneChild",
+        "individualName": "createOneChild", 
+        "organisationName":"createOneChild",
+        "positionName":"createOneChild"
+    },
 
     /**
      * Constructor: OpenLayers.Format.CSWGetRecords.v2_0_2
@@ -295,212 +485,26 @@
             },
             "*": function(node, obj) {
                 var name = node.localName || node.nodeName.split(":").pop();
-                if (name in this.readers.gmd._createOneChild) {
-                    obj[name] = this.readChildNodes(node);
-                } else if (name in this.readers.gmd._createManyChildren) {
-                    if (!(obj[name] instanceof Array)) {
-                        obj[name] = [];
-                    }
-                    obj[name].push(this.readChildNodes(node));
-                } else if (name in this.readers.gmd._pass) {
-                    this.readChildNodes(node, obj);
-                } else if (name in this.readers.gmd._readAttributes) {
-                    var attrs = node.attributes;
-                    for(var i=0, len=attrs.length; i<len; ++i) {
-                        obj[attrs[i].name] = attrs[i].nodeValue;
-                    }
+                switch (this.parsers[name]) {
+                    case "readAttributes":
+                        var attrs = node.attributes;
+                        for(var i=0, len=attrs.length; i<len; ++i) {
+                            obj[attrs[i].name] = attrs[i].nodeValue;
+                        }
+                        break;
+                    case "pass":
+                        this.readChildNodes(node, obj);
+                        break;
+                    case "createManyChildren":
+                        if (!(obj[name] instanceof Array)) {
+                            obj[name] = [];
+                        }
+                        obj[name].push(this.readChildNodes(node));
+                        break;
+                    case "createOneChild":
+                        obj[name] = this.readChildNodes(node);
+                        break;
                 }
-            },
-            "_readAttributes": {
-                "CI_RoleCode": null,
-                "MD_ProgressCode": null,
-                "MD_KeywordTypeCode": null,
-                "MD_RestrictionCode": null,
-                "MD_SpatialRepresentationTypeCode": null,
-                "MD_CharacterSetCode": null,
-                "CI_DateTypeCode": null,
-                "MD_TopologyLevelCode": null,
-                "MD_GeometricObjectTypeCode": null,
-                "MD_DimensionNameTypeCode": null,
-                "MD_CellGeometryCode": null,
-                "MD_MaintenanceFrequencyCode": null,
-                "MD_ScopeCode": null
-            },
-            "_pass": {
-                "CI_ResponsibleParty": null,
-                "CI_Contact": null,
-                "CI_Telephone": null,
-                "CI_Address": null,
-                "MD_DataIdentification": null,
-                "MD_Keywords": null,
-                "MD_LegalConstraints": null,
-                "MD_Resolution": null,
-                "MD_RepresentativeFraction": null,
-                "EX_Extent": null,
-                "EX_GeographicBoundingBox": null,
-                "EX_TemporalExtent": null,
-                "MD_Distribution": null,
-                "MD_Distributor": null,
-                "MD_DigitalTransferOptions": null,
-                "MD_Format": null,
-                "MD_Medium": null,
-                "CI_OnlineResource": null,
-                "MD_ReferenceSystem": null,
-                "RS_Identifier": null,
-                "CI_Citation": null,
-                "CI_Date": null,
-                "MD_GridSpatialRepresentation": null,
-                "MD_VectorSpatialRepresentation": null,
-                "MD_GeometricObjects": null,
-                "MD_Dimension": null,
-                "MD_MaintenanceInformation": null,
-                "MD_ScopeDescription": null,
-                "MD_BrowseGraphic": null,
-                "DQ_DataQuality": null,
-                "DQ_Scope": null,
-                "DQ_Element": null,
-                "LI_Lineage": null,
-                "LI_Source":null,
-                "LI_ProcessStep":null,
-                "MD_ReferenceSystem":null
-            },
-            "_createManyChildren": {
-                "contact": null,
-                "voice": null,
-                "facsimile": null,
-                "deliveryPoint": null,
-                "electronicMailAddress": null,
-                "identificationInfo": null,
-                "pointOfContact": null,
-                "status": null,
-                "descriptiveKeywords": null,
-                "keyword": null,
-                "resourceConstraints": null,
-                "useLimitation": null,
-                "accessConstraints": null,
-                "useConstraints": null,
-                "otherConstraints": null,
-                "spatialResolution": null,
-                "spatialRepresentationType": null,
-                "language": null,
-                "characterSet": null,
-                "topicCategory": null,
-                "geographicElement": null,
-                "temporalElement": null,
-                "distributor": null,
-                "transferOptions": null,
-                "distributionFormat": null,
-                "distributionOrderProcess": null,
-                "distributorFormat": null,
-                "formatDistributor": null,
-                "distributorTransferOptions": null,
-                "onLine": null,
-                "referenceSystemInfo": null,
-                "alternateTitle": null,
-                "date": null,
-                "identifier": null,
-                "citedResponsibleParty": null,
-                "presentationForm": null,
-                "spatialRepresentationInfo": null,
-                "geometricObjects": null,
-                "axisDimensionProperties": null,
-                "resourceMaintenance": null,
-                "updateScope": null,
-                "updateScopeDescription": null,
-                "maintenanceNote": null,
-                "attributes": null,
-                "features": null,
-                "featureInstances": null,
-                "attributeInstances": null,
-                "graphicOverview": null,
-                "dataQualityInfo": null,
-                "report": null,
-                "levelDescription":null,
-                "processStep":null,
-                "source":null,
-                "sourceExtent":null,
-                "sourceStep":null,
-                "processor":null
-            },
-            "_createOneChild": {
-                "dateTime":null,
-                "rationale":null,
-                "description":null,
-                "statement":null,
-                "scaleDenominator":null,
-                "sourceReferenceSystem":null,
-                "sourceCitation":null,
-                "level": null,
-                "scope": null,
-                "lineage": null,
-                "fileName":null,
-                "fileDescription":null,
-                "fileType":null,
-                "other":null,
-                "maintenanceAndUpdateFrequency":null,
-                "userDefinedMaintenanceFrequency":null,
-                "dataset":null,
-                "citation":null,
-                "dateOfNextUpdate":null,
-                "dimensionName":null,
-                "dimensionSize":null,
-                "resolution":null,
-                "numberOfDimensions":null,
-                "cellGeometry":null,
-                "transformationParameterAvailability":null,
-                "geometricObjectType":null,
-                "geometricObjectCount":null,
-                "topologyLevel":null,
-                "dateType":null,
-                "title":null,
-                "edition":null,
-                "editionDate":null,
-                "series":null,
-                "otherCitationDetails":null,
-                "collectiveTitle":null,
-                "ISBN":null,
-                "ISSN":null,
-                "authority":null,
-                "code":null,
-                "referenceSystemIdentifier":null,
-                "linkage":null,
-                "protocol":null,
-                "unitsOfDistribution":null,
-                "transferSize":null,
-                "offLine":null,
-                "name":null,
-                "version":null,
-                "amendmentNumber":null,
-                "specification":null,
-                "fileDecompressionTechnique":null,
-                "distributorContact":null,
-                "distributionInfo":null,
-                "westBoundLongitude":null,
-                "eastBoundLongitude":null,
-                "southBoundLatitude":null,
-                "northBoundLatitude":null,
-                "supplementalInformation":null,
-                "denominator":null,
-                "equivalentScale":null,
-                "type":null,
-                "purpose":null,
-                "abstract":null,
-                "city":null,
-                "administrativeArea":null,
-                "postalCode":null,
-                "country":null,
-                "address":null,
-                "phone":null,
-                "contactInfo":null,
-                "role": null,
-                "fileIdentifier": null,
-                "language": null,
-                "dateStamp": null,
-                "metadataStandardName": null,
-                "metadataStandardVersion": null,
-                "individualName": null, 
-                "organisationName":null,
-                "positionName":null
             }
         },
         "gml": { // TODO: should be elsewhere



More information about the Commits mailing list