2 * @requires OpenLayers/Format/XML.js
6 * Class: OpenLayers.Format.WFSCapabilities
7 * Read WFS Capabilities.
10 * - <OpenLayers.Format.XML>
12 OpenLayers.Format.WFSCapabilities = OpenLayers.Class(OpenLayers.Format.XML, {
15 * APIProperty: defaultVersion
16 * {String} Version number to assume if none found. Default is "1.1.0".
18 defaultVersion: "1.1.0",
21 * APIProperty: version
22 * {String} Specify a version string if one is known.
27 * Constructor: OpenLayers.Format.WFSCapabilities
28 * Create a new parser for WFS capabilities.
31 * options - {Object} An optional object whose properties will be set on
34 initialize: function(options) {
35 OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
36 this.options = options;
41 * Read capabilities data from a string, and return a list of layers.
44 * data - {String} or {DOMElement} data to read/parse.
47 * {Array} List of named layers.
49 read: function(data) {
50 if(typeof data == "string") {
51 data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
53 var root = data.documentElement;
54 var version = this.version;
56 version = root.getAttribute("version");
58 version = this.defaultVersion;
61 var constr = OpenLayers.Format.WFSCapabilities[
62 "v" + version.replace(/\./g, "_")
65 throw "Can't find a WFS capabilities parser for version " + version;
67 var parser = new constr(this.options);
68 var capabilities = parser.read(data);
69 capabilities.version = version;
73 CLASS_NAME: "OpenLayers.Format.WFSCapabilities"