[OpenLayers-Commits] r10913 - sandbox/bartvde/openls/openlayers/lib/OpenLayers/Format/XLS

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Tue Nov 23 09:19:56 EST 2010


Author: bartvde
Date: 2010-11-23 06:19:56 -0800 (Tue, 23 Nov 2010)
New Revision: 10913

Added:
   sandbox/bartvde/openls/openlayers/lib/OpenLayers/Format/XLS/v1.js
   sandbox/bartvde/openls/openlayers/lib/OpenLayers/Format/XLS/v1_1_0.js
Log:
work in progress

Added: sandbox/bartvde/openls/openlayers/lib/OpenLayers/Format/XLS/v1.js
===================================================================
--- sandbox/bartvde/openls/openlayers/lib/OpenLayers/Format/XLS/v1.js	                        (rev 0)
+++ sandbox/bartvde/openls/openlayers/lib/OpenLayers/Format/XLS/v1.js	2010-11-23 14:19:56 UTC (rev 10913)
@@ -0,0 +1,143 @@
+/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for 
+ * full list of contributors). Published under the Clear BSD license.  
+ * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Format/XLS.js
+ */
+
+/**
+ * Class: OpenLayers.Format.XLS.v1
+ * Superclass for XLS version 1 parsers.
+ *
+ * Inherits from:
+ *  - <OpenLayers.Format.XML>
+ */
+OpenLayers.Format.XLS.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
+    
+    /**
+     * Property: namespaces
+     * {Object} Mapping of namespace aliases to namespace URIs.
+     */
+    namespaces: {
+        xls: "http://www.opengis.net/xls",
+        gml: "http://www.opengis.net/gml",
+        xsi: "http://www.w3.org/2001/XMLSchema-instance"
+    },
+    
+    /**
+     * Property: defaultPrefix
+     */
+    defaultPrefix: "xls",
+
+    /**
+     * Property: schemaLocation
+     * {String} Schema location for a particular minor version.
+     */
+    schemaLocation: null,
+    
+    /**
+     * Constructor: OpenLayers.Format.XLS.v1
+     * Instances of this class are not created directly.  Use the
+     *     <OpenLayers.Format.XLS> constructor instead.
+     *
+     * Parameters:
+     * options - {Object} An optional object whose properties will be set on
+     *     this instance.
+     */
+    initialize: function(options) {
+        OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
+    },
+    
+    /**
+     * Method: read
+     *
+     * Parameters:
+     * data - {DOMElement} An XLS document element.
+     * options - {Object} Options for the reader.
+     *
+     * Returns:
+     * {Object} An object representing the XLSResponse.
+     */
+    read: function(data, options) {
+        options = OpenLayers.Util.applyDefaults(options, this.options);
+        var xls = {};
+        this.readChildNodes(data, xls);
+        return xls;
+    },
+    
+    /**
+     * Property: readers
+     * Contains public functions, grouped by namespace prefix, that will
+     *     be applied when a namespaced node is found matching the function
+     *     name.  The function will be applied in the scope of this parser
+     *     with two arguments: the node being read and a context object passed
+     *     from the parent.
+     */
+    readers: {
+        "xls": {
+            "StyledLayerDescriptor": function(node, sld) {
+                sld.version = node.getAttribute("version");
+                this.readChildNodes(node, sld);
+            },
+            "Name": function(node, obj) {
+                obj.name = this.getChildValue(node);
+            },
+            "Title": function(node, obj) {
+                obj.title = this.getChildValue(node);
+            },
+            "Abstract": function(node, obj) {
+                obj.description = this.getChildValue(node);
+            }
+        }
+    },
+    
+    /**
+     * Method: write
+     *
+     * Parameters:
+     * request - {Object} An object representing the geocode request.
+     *
+     * Returns:
+     * {DOMElement} The root of an XLS document.
+     */
+    write: function(request) {
+        return this.writers.xls.XLS.apply(this, [request]);
+    },
+    
+    /**
+     * Property: writers
+     * As a compliment to the readers property, this structure contains public
+     *     writing functions grouped by namespace alias and named like the
+     *     node names they produce.
+     */
+    writers: {
+        "xls": {
+            "XLS": function(request) {
+                var root = this.createElementNSPlus(
+                    "xls:XLS",
+                    {attributes: {
+                        "version": this.VERSION,
+                        "xsi:schemaLocation": this.schemaLocation
+                    }}
+                );
+                this.writeNode("RequestHeader", request.header, root);
+                this.writeNode("Request", request, root);
+                return root;
+            },
+            "RequestHeader": function(header) {
+                return this.createElementNSPlus("xls:RequestHeader", {
+                    attributes: {clientName: header.clientName,
+                        clientPassword: header.clientPassword}
+                });
+            },
+            "Request": function(request) {
+                return this.createElementNSPlus("xls:Request");
+            }
+        }
+    },
+    
+    CLASS_NAME: "OpenLayers.Format.XLS.v1" 
+
+});

Added: sandbox/bartvde/openls/openlayers/lib/OpenLayers/Format/XLS/v1_1_0.js
===================================================================
--- sandbox/bartvde/openls/openlayers/lib/OpenLayers/Format/XLS/v1_1_0.js	                        (rev 0)
+++ sandbox/bartvde/openls/openlayers/lib/OpenLayers/Format/XLS/v1_1_0.js	2010-11-23 14:19:56 UTC (rev 10913)
@@ -0,0 +1,50 @@
+/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for 
+ * full list of contributors). Published under the Clear BSD license.  
+ * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Format/XLS/v1.js
+ */
+
+/**
+ * Class: OpenLayers.Format.XLS.v1_1_0
+ * Read / write XLS version 1.1.0.
+ * 
+ * Inherits from:
+ *  - <OpenLayers.Format.XLS.v1>
+ */
+OpenLayers.Format.XLS.v1_1_0 = OpenLayers.Class(
+    OpenLayers.Format.XLS.v1, {
+    
+    /**
+     * Constant: VERSION
+     * {String} 1.1.0
+     */
+    VERSION: "1.1.0",
+    
+    /**
+     * Property: schemaLocation
+     * {String} http://www.opengis.net/xls
+     *   http://schemas.opengis.net/ols/1.1.0/LocationUtilityService.xsd
+     */
+    schemaLocation: "http://www.opengis.net/xls http://schemas.opengis.net/ols/1.1.0/LocationUtilityService.xsd",
+
+    /**
+     * Constructor: OpenLayers.Format.XLS.v1_1_0
+     * Instances of this class are not created directly.  Use the
+     *     <OpenLayers.Format.XLS> constructor instead.
+     *
+     * Parameters:
+     * options - {Object} An optional object whose properties will be set on
+     *     this instance.
+     */
+    initialize: function(options) {
+        OpenLayers.Format.XLS.v1.prototype.initialize.apply(
+            this, [options]
+        );
+    },
+
+    CLASS_NAME: "OpenLayers.Format.XLS.v1_1_0" 
+
+});



More information about the Commits mailing list