diff --git a/lib/OpenLayers.js b/lib/OpenLayers.js index 2795c997d1..0c28416ea7 100644 --- a/lib/OpenLayers.js +++ b/lib/OpenLayers.js @@ -216,6 +216,10 @@ "OpenLayers/Format/KML.js", "OpenLayers/Format/GeoRSS.js", "OpenLayers/Format/WFS.js", + "OpenLayers/Format/WFSCapabilities.js", + "OpenLayers/Format/WFSCapabilities/v1.js", + "OpenLayers/Format/WFSCapabilities/v1_0_0.js", + "OpenLayers/Format/WFSCapabilities/v1_1_0.js", "OpenLayers/Format/WFSDescribeFeatureType.js", "OpenLayers/Format/WMSDescribeLayer.js", "OpenLayers/Format/WMSDescribeLayer/v1_1.js", diff --git a/lib/OpenLayers/Format/WFSCapabilities/v1.js b/lib/OpenLayers/Format/WFSCapabilities/v1.js new file mode 100644 index 0000000000..4402a262e5 --- /dev/null +++ b/lib/OpenLayers/Format/WFSCapabilities/v1.js @@ -0,0 +1,117 @@ +/** + * @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 + */ +OpenLayers.Format.WFSCapabilities.v1_0_0 = OpenLayers.Class( + OpenLayers.Format.WFSCapabilities.v1, { + + /** + * Constructor: OpenLayers.Format.WFSCapabilities.v1_0_0 + * Create a new parser for WFS capabilities version 1.0.0. + * + * Parameters: + * options - {Object} An optional object whose properties will be set on + * this instance. + */ + initialize: function(options) { + OpenLayers.Format.WFSCapabilities.v1.prototype.initialize.apply( + this, [options] + ); + }, + + CLASS_NAME: "OpenLayers.Format.WFSCapabilities.v1_0_0" + +}); \ No newline at end of file diff --git a/lib/OpenLayers/Format/WFSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WFSCapabilities/v1_1_0.js new file mode 100644 index 0000000000..4ef24e184b --- /dev/null +++ b/lib/OpenLayers/Format/WFSCapabilities/v1_1_0.js @@ -0,0 +1,31 @@ +/** + * @requires OpenLayers/Format/WFSCapabilities/v1.js + */ + +/** + * Class: OpenLayers.Format.WFSCapabilities/v1_1_0 + * Read WFS Capabilities version 1.1.0. + * + * Inherits from: + * - + */ +OpenLayers.Format.WFSCapabilities.v1_1_0 = OpenLayers.Class( + OpenLayers.Format.WFSCapabilities.v1, { + + /** + * Constructor: OpenLayers.Format.WFSCapabilities.v1_1_0 + * Create a new parser for WFS capabilities version 1.1.0. + * + * Parameters: + * options - {Object} An optional object whose properties will be set on + * this instance. + */ + initialize: function(options) { + OpenLayers.Format.WFSCapabilities.v1.prototype.initialize.apply( + this, [options] + ); + }, + + CLASS_NAME: "OpenLayers.Format.WFSCapabilities.v1_1_0" + +}); \ No newline at end of file diff --git a/tests/Format/WFSCapabilities/v1.html b/tests/Format/WFSCapabilities/v1.html new file mode 100644 index 0000000000..45f22d8259 --- /dev/null +++ b/tests/Format/WFSCapabilities/v1.html @@ -0,0 +1,128 @@ + + + + + + + + diff --git a/tests/list-tests.html b/tests/list-tests.html index 31c6c06326..c2aa182a01 100644 --- a/tests/list-tests.html +++ b/tests/list-tests.html @@ -59,9 +59,10 @@
  • Format/Filter/v1.html
  • Format/Filter/v1_0_0.html
  • Format/Filter/v1_1_0.html
  • -
  • Format/WFSDescribeFeatureType.html
  • -
  • Format/WMSDescribeLayer.html
  • Format/WFS.html
  • +
  • Format/WFSCapabilities.html
  • +
  • Format/WFSCapabilities/v1.html
  • +
  • Format/WFSDescribeFeatureType.html
  • Format/WFST.html
  • Format/WFST/v1.html
  • Format/WFST/v1_0_0.html
  • @@ -72,6 +73,7 @@
  • Format/WMC/v1.html
  • Format/WMSCapabilities.html
  • Format/WMSCapabilities/v1_1_1.html
  • +
  • Format/WMSDescribeLayer.html
  • Format/WMSGetFeatureInfo.html
  • Format/XML.html
  • Geometry.html