[OpenLayers-Commits] r10914 - in sandbox/bartvde/openls/openlayers: examples lib/OpenLayers/Format/XLS

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Tue Nov 23 10:15:26 EST 2010


Author: bartvde
Date: 2010-11-23 07:15:25 -0800 (Tue, 23 Nov 2010)
New Revision: 10914

Modified:
   sandbox/bartvde/openls/openlayers/examples/openls.html
   sandbox/bartvde/openls/openlayers/lib/OpenLayers/Format/XLS/v1.js
   sandbox/bartvde/openls/openlayers/lib/OpenLayers/Format/XLS/v1_1_0.js
Log:
request now validates with Oxygen, however the ESRI service does not consume

Modified: sandbox/bartvde/openls/openlayers/examples/openls.html
===================================================================
--- sandbox/bartvde/openls/openlayers/examples/openls.html	2010-11-23 14:19:56 UTC (rev 10913)
+++ sandbox/bartvde/openls/openlayers/examples/openls.html	2010-11-23 15:15:25 UTC (rev 10914)
@@ -11,7 +11,14 @@
 
         function init(){
             var format = new OpenLayers.Format.XLS();
-            var request = format.write({header: {clientName: 'ArcLocation'}});
+            var address = {
+                countryCode: 'US', 
+                street: '1 Freedom Rd', 
+                municipality: 'Providence', 
+                countrySubdivision: 'RI',
+                postalCode: '02909'
+            };
+            var request = format.write({header: {clientName: 'ArcLocation'}, address: address});
             console.log(request);
         }
     </script>

Modified: sandbox/bartvde/openls/openlayers/lib/OpenLayers/Format/XLS/v1.js
===================================================================
--- sandbox/bartvde/openls/openlayers/lib/OpenLayers/Format/XLS/v1.js	2010-11-23 14:19:56 UTC (rev 10913)
+++ sandbox/bartvde/openls/openlayers/lib/OpenLayers/Format/XLS/v1.js	2010-11-23 15:15:25 UTC (rev 10914)
@@ -133,7 +133,70 @@
                 });
             },
             "Request": function(request) {
-                return this.createElementNSPlus("xls:Request");
+                var node = this.createElementNSPlus("xls:Request", {
+                    attributes: {
+                        methodName: "GeocodeRequest",
+                        requestID: request.requestID || "",
+                        version: this.VERSION
+                    }
+                });
+                this.writeNode("GeocodeRequest", request.address, node);
+                return node;
+            },
+            "GeocodeRequest": function(address) {
+                var node = this.createElementNSPlus("xls:GeocodeRequest");
+                this.writeNode("Address", address, node);
+                return node;
+            },
+            "Address": function(address) {
+                var node = this.createElementNSPlus("xls:Address", {
+                    attributes: {
+                        countryCode: address.countryCode
+                    }
+                });
+                if (address.street) {
+                    this.writeNode("StreetAddress", address.street, node);
+                }
+                if (address.municipality) {
+                    this.writeNode("Municipality", address.municipality, node);
+                }
+                if (address.countrySubdivision) {
+                    this.writeNode("CountrySubdivision", address.countrySubdivision, node);
+                }
+                if (address.postalCode) {
+                    this.writeNode("PostalCode", address.postalCode, node);
+                }
+                return node;
+            },
+            "StreetAddress": function(street) {
+                var node = this.createElementNSPlus("xls:StreetAddress");
+                this.writeNode("Street", street, node);
+                return node; 
+                
+            },
+            "Street": function(street) {
+                return this.createElementNSPlus("xls:Street", {value: street});
+            },
+            "Municipality": function(municipality) {
+                return this.createElementNSPlus("xls:Place", {
+                    attributes: {
+                        type: "Municipality"
+                    },
+                    value: municipality
+                });
+            },
+            "CountrySubdivision": function(countrySubdivision) {
+                return this.createElementNSPlus("xls:Place", {
+                    attributes: {
+                        type: "CountrySubdivision"
+                    },
+                    value: countrySubdivision
+                });
+            },
+            "PostalCode": function(postalCode) {
+                return this.createElementNSPlus("xls:PostalCode", {
+                    value: postalCode
+                });
             }
         }
     },

Modified: sandbox/bartvde/openls/openlayers/lib/OpenLayers/Format/XLS/v1_1_0.js
===================================================================
--- sandbox/bartvde/openls/openlayers/lib/OpenLayers/Format/XLS/v1_1_0.js	2010-11-23 14:19:56 UTC (rev 10913)
+++ sandbox/bartvde/openls/openlayers/lib/OpenLayers/Format/XLS/v1_1_0.js	2010-11-23 15:15:25 UTC (rev 10914)
@@ -19,9 +19,9 @@
     
     /**
      * Constant: VERSION
-     * {String} 1.1.0
+     * {String} 1.1
      */
-    VERSION: "1.1.0",
+    VERSION: "1.1",
     
     /**
      * Property: schemaLocation



More information about the Commits mailing list