--- a/labs/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1.js +++ b/labs/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1.js @@ -1,1 +1,127 @@ +/* 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/WFSCapabilities.js + */ + +/** + * Class: OpenLayers.Format.WFSCapabilities.v1 + * Abstract class not to be instantiated directly. + * + * Inherits from: + * - + */ +OpenLayers.Format.WFSCapabilities.v1 = OpenLayers.Class( + OpenLayers.Format.WFSCapabilities, { + + /** + * Constructor: OpenLayers.Format.WFSCapabilities.v1_1 + * Create an instance of one of the subclasses. + * + * 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]); + this.options = options; + }, + + /** + * APIMethod: read + * Read capabilities data from a string, and return a list of layers. + * + * Parameters: + * data - {String} or {DOMElement} data to read/parse. + * + * Returns: + * {Array} List of named layers. + */ + read: function(data) { + if(typeof data == "string") { + data = OpenLayers.Format.XML.prototype.read.apply(this, [data]); + } + var capabilities = {}; + var root = data.documentElement; + this.runChildNodes(capabilities, root); + return capabilities; + }, + + /** + * Method: runChildNodes + */ + runChildNodes: function(obj, node) { + var children = node.childNodes; + var childNode, processor; + for(var i=0; i 0) { + obj.featureNS = this.lookupNamespaceURI(node, parts[0]); + } + } + }, + + /** + * Method: read_cap_Title + */ + read_cap_Title: function(obj, node) { + var title = this.getChildValue(node); + if(title) { + obj.title = title; + } + }, + + /** + * Method: read_cap_Abstract + */ + read_cap_Abstract: function(obj, node) { + var abst = this.getChildValue(node); + if(abst) { + obj["abstract"] = abst; + } + }, + + CLASS_NAME: "OpenLayers.Format.WFSCapabilities.v1" + +}); +